home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!pacbell!oracle!unrepliable!bounce
- Newsgroups: comp.databases.oracle
- From: kjou@oracle.com (Kathy Jou)
- Subject: Re: Declaring sequence number qualifiers in Pro*c
- Message-ID: <1992Aug26.184823.8375@oracle.us.oracle.com>
- Sender: Kathy Jou
- Nntp-Posting-Host: dvlpyr
- Organization: Oracle Corporation
- References: <BtHyqq.1Mn@netnews.jhuapl.edu> <4264@wet.UUCP> <BtJF1H.G5s@ibmpcug.co.uk>
- Date: Wed, 26 Aug 1992 18:48:23 GMT
- X-Disclaimer: This message was written by an unauthenticated user
- at Oracle Corporation. The opinions expressed are those
- of the user and not necessarily those of Oracle.
- Lines: 45
-
- In article <BtJF1H.G5s@ibmpcug.co.uk> boxfield@ibmpcug.co.uk (Paul J Snelling) writes:
- >>suthemb1@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...
-
-