home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / database / oracle / 1392 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  2.3 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!pacbell!oracle!unrepliable!bounce
  2. Newsgroups: comp.databases.oracle
  3. From: kjou@oracle.com (Kathy Jou)
  4. Subject: Re: Declaring sequence number qualifiers in Pro*c
  5. Message-ID: <1992Aug26.184823.8375@oracle.us.oracle.com>
  6. Sender: Kathy Jou
  7. Nntp-Posting-Host: dvlpyr
  8. Organization: Oracle Corporation
  9. References: <BtHyqq.1Mn@netnews.jhuapl.edu> <4264@wet.UUCP> <BtJF1H.G5s@ibmpcug.co.uk>
  10. Date: Wed, 26 Aug 1992 18:48:23 GMT
  11. X-Disclaimer: This message was written by an unauthenticated user
  12.               at Oracle Corporation.  The opinions expressed are those
  13.               of the user and not necessarily those of Oracle.
  14. Lines: 45
  15.  
  16. In article <BtJF1H.G5s@ibmpcug.co.uk> boxfield@ibmpcug.co.uk (Paul J Snelling) writes:
  17. >>suthemb1@jhuapl.edu (Marvin Suther) writes:
  18. >>>  I am writing a Pro*C application and am trying to access an already existing 
  19. >>> sequence number. However, no matter how I declare the sequence number id, I 
  20. >>> receive an error message  that the sequence id  does not exist. All 
  21. >>> documentation only references the use and not the declaration. Anyone know 
  22. >>> how this is declared?
  23. >>
  24. >
  25. >Perhaps you are trying to access sequence.curval (last used value) before
  26. >accessing sequence.nextval (next available value).
  27. >
  28. >Unfortunately in any session, you must access nextval before curval is
  29. >available to you...
  30. >
  31. >-- 
  32. >Paul Snelling,    BoxField Systems Ltd
  33.  
  34. Marvin,
  35.  
  36. Are you getting this error message when you precompile your PRO*C program
  37. or during runtime?  What is the sqlcheck option set to?  SQLCHECK=limited 
  38. does partial checks on the SQL statements, like object existence.  I think 
  39. some older versions of PRO*C had problems distinguishing table and sequence 
  40. names.  Precompile your PRO*C program with sqlcheck=none (the default) if the
  41. error occurs when you precompile.  If it is a runtime error, then make sure
  42. the user connecting to ORACLE in the program has access to that sequence
  43. (if not the owner).  Try it in sqlplus, too.
  44.  
  45. Here's an example:
  46.  
  47. ----->
  48. EXEC SQL BEGIN DECLARE SECTION;
  49.         int next_sequence;
  50. EXEC SQL END DECLARE SECTION;
  51.  
  52. EXEC SQL SELECT sequence_name.nextval into :next_sequence from sys.dual;
  53. printf("The next sequence is %d.\n", next_sequence);
  54. <-----
  55.  
  56.  
  57. -- Kathy Jou
  58. -- Oracle Corporation
  59. -- Disclaimer:  Only my opinions are expressed here...
  60.  
  61.