Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie sequence problem.
You have to use the following SELECT, since a sequence is a database object, not a PL/SQL object:
SELECT table1SequenceID.CURRVAL
INTO variable1
FROM dual;
Tom Redfern wrote:
>
> All I find about sequences states that a sequence CURRVAL
> should be available to everything except "as columns", "in subqueries",
> and a few other circumstances. No mention of being unavailable to
> triggers. The realavant sequence works for inserts, but the
> following trigger failes at compile time without ora-.. error message:
>
> CREATE OR REPLACE TRIGGER trigger1 AFTER INSERT ON table1
> DECLARE varialbe1 table1.primarykey%TYPE;
> BEGIN
> variable1 := table1SequenceID.CURRVAL;
> ... code that works if variable 1 is substituted
> END;
>
> The offending line is the second line. Remove it, and the
> whole thing works. Any clues?
>
> Note the sig below if your going to reply via mail. Sorry, but I'm on
> uucp.
>
> Thank you for any help.
>
> \\ ~ ~ //
> ( @ @ )
> ===============-oOOo-(_)-oOOo-==================
> Red Hat Linux! Where I really went today!
> Please send personal replies to the address
> derived by removing the "x" from the
> following address: thos_at_jeeves.seaxslug.org
> =========================-Oooo.-================
> .oooO ( )
> ( ) ) /
> \ ( (_/
> `'
Received on Thu Feb 26 1998 - 00:00:00 CST
![]() |
![]() |