home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / database / oracle / 1080 next >
Encoding:
Text File  |  1992-07-21  |  1013 b   |  37 lines

  1. Newsgroups: comp.databases.oracle
  2. Path: sparky!uunet!centerline!news
  3. From: Devan F. Dewey <dewey@centerline.com>
  4. Subject: Re: Referencing a SEQUENCE from a trigger...
  5. Message-ID: <1992Jul21.121227.1455@centerline.com>
  6. Sender: news@centerline.com
  7. Nntp-Posting-Host: sebastian
  8. Organization: CenterLine Software
  9. X-Useragent: Nuntius v1.1a2
  10. References: <1992Jul20.195514.8085@unixg.ubc.ca>
  11. Date: Tue, 21 Jul 1992 12:12:27 GMT
  12. Lines: 23
  13.  
  14.  
  15.  
  16. >I've got a situation where I need to insert rows into a table in a 
  17. >ON-VALIDATE-FIELD trigger. For these rows, I need a serial no which I'm
  18. >getting from a SEQUENCE. However, I can't seem to reference the SEQUENCE.
  19. >I'm doing something like:
  20. >
  21. >  new_ref := :SEQUENCE.V_REF_NO_SEQ.NEXTVAL;
  22. >
  23. >which gets me the error messages:
  24. >
  25. >  PL/SQL error 49 at line 10, column 16:
  26. >     bad bind variable 'sequence.v_ref_no_seq'
  27.  
  28. Form V3 I hope.
  29.  
  30. To reference a sequence, you must use select into:
  31.  
  32. select SEQUENCE.V_REF_NO_SEQ.NEXTVAL into new_ref from dual;
  33.  
  34. Hope this helps.
  35.  
  36. -Devan
  37.