Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie sequence problem.
A copy of this was sent to Tom Redfern <herald_at_jeeves.seaxslug.org> (if that email address didn't require changing) On Thu, 26 Feb 1998 07:53:02 -0800, you 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;
you cannot access sequences except in SQL try this:
select table1SequenceID.currval INTO variabl1 from dual;
that'll get it.
> ... 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 ( )
> ( ) ) /
> \ ( (_/
> `'
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Feb 27 1998 - 00:00:00 CST