Re: Declaring sequence number qualifiers in Pro*c

From: Kathy Jou <kjou_at_oracle.com>
Date: Wed, 26 Aug 1992 18:48:23 GMT
Message-ID: <1992Aug26.184823.8375_at_oracle.us.oracle.com>


In article <BtJF1H.G5s_at_ibmpcug.co.uk> boxfield_at_ibmpcug.co.uk (Paul J Snelling) writes:
>>suthemb1_at_jhuapl.edu (Marvin Suther) writes:
>>> I am writing a Pro*C application and am trying to access an already existing
>>> sequence number. However, no matter how I declare the sequence number id, I
>>> receive an error message that the sequence id does not exist. All
>>> documentation only references the use and not the declaration. Anyone know
>>> how this is declared?
>>
>
>Perhaps you are trying to access sequence.curval (last used value) before
>accessing sequence.nextval (next available value).
>
>Unfortunately in any session, you must access nextval before curval is
>available to you...
>
>--
>Paul Snelling, BoxField Systems Ltd

Marvin,

Are you getting this error message when you precompile your PRO*C program or during runtime? What is the sqlcheck option set to? SQLCHECK=limited does partial checks on the SQL statements, like object existence. I think some older versions of PRO*C had problems distinguishing table and sequence names. Precompile your PRO*C program with sqlcheck=none (the default) if the error occurs when you precompile. If it is a runtime error, then make sure the user connecting to ORACLE in the program has access to that sequence (if not the owner). Try it in sqlplus, too.

Here's an example:

----->
EXEC SQL BEGIN DECLARE SECTION;
        int next_sequence;
EXEC SQL END DECLARE SECTION; EXEC SQL SELECT sequence_name.nextval into :next_sequence from sys.dual; printf("The next sequence is %d.\n", next_sequence); <-----

  • Kathy Jou
  • Oracle Corporation
  • Disclaimer: Only my opinions are expressed here...
Received on Wed Aug 26 1992 - 20:48:23 CEST

Original text of this message