<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Sequence functions</title>
    <link>/en/sql-reference/functions/data-type-specific-functions/sequence-functions/</link>
    <description>Recent content in Sequence functions on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/functions/data-type-specific-functions/sequence-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: CURRVAL</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/sequence-functions/currval/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/sequence-functions/currval/</guid>
      <description>
        
        
        &lt;p&gt;Returns the last value across all nodes that was set by &lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/sequence-functions/nextval/#&#34;&gt;NEXTVAL&lt;/a&gt; on this sequence in the current session. If NEXTVAL was never called on this sequence since its creation, OpenText™ Analytics Database returns an error.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CURRVAL (&amp;#39;[[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;sequence-name&lt;/span&gt;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;sequence-name &lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The target sequence&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;SELECT privilege on sequence&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on sequence schema&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;restrictions&#34;&gt;Restrictions&lt;/h2&gt;
&lt;p&gt;You cannot invoke CURRVAL in a SELECT statement, in the following contexts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;WHERE clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;GROUP BY clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ORDER BY clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DISTINCT clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;UNION&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Subquery&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You also cannot invoke CURRVAL to act on a sequence in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;UPDATE or DELETE subqueries&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Views&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../../en/admin/working-with-native-tables/sequences/named-sequences/creating-and-using-named-sequences/#&#34;&gt;Creating and using named sequences&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/sequence-functions/nextval/#&#34;&gt;NEXTVAL&lt;/a&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: NEXTVAL</title>
      <link>/en/sql-reference/functions/data-type-specific-functions/sequence-functions/nextval/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/data-type-specific-functions/sequence-functions/nextval/</guid>
      <description>
        
        
        &lt;p&gt;Returns the next value in a sequence. Call NEXTVAL after creating a sequence to initialize the sequence with its default value. Thereafter, call NEXTVAL to increment the sequence value for ascending sequences, or decrement its value for descending sequences.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;NEXTVAL (&amp;#39;[[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;sequence&lt;/span&gt;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;sequence&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Identifies the target sequence.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;SELECT privilege on sequence&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;USAGE privilege on sequence schema&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;restrictions&#34;&gt;Restrictions&lt;/h2&gt;
&lt;p&gt;You cannot invoke NEXTVAL in a SELECT statement, in the following contexts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;WHERE clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;GROUP BY clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ORDER BY clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DISTINCT clause&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;UNION&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Subquery&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You also cannot invoke NEXTVAL to act on a sequence in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;UPDATE or DELETE subqueries&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Views&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can use subqueries to work around some of these restrictions. For example, to use sequences with a DISTINCT clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT t.col1, shift_allocation_seq.NEXTVAL FROM (
     SELECT DISTINCT col1 FROM av_temp1) t;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../../en/admin/working-with-native-tables/sequences/named-sequences/creating-and-using-named-sequences/#&#34;&gt;Creating and using named sequences&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/sequence-functions/currval/#&#34;&gt;CURRVAL&lt;/a&gt;

      </description>
    </item>
    
  </channel>
</rss>
