Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: New to DB Triggers..can U find the error?

Re: New to DB Triggers..can U find the error?

From: Paul Passarelli <paulp_at_spam.netcom.com>
Date: 1997/08/22
Message-ID: <01bcaf04$e4171820$0f02000a@passarelli>#1/1

Kelly,

  I believe that "seq_address_id.nextval" is not a value, it's a pseudo column, not a big deal though. What you should do is to declate a local number then assign the sequence value to the number then use the local in the INSERT ... VALUES(...)

  Take a look below, I thing this wall do what you need it to do.

Kelly <kgrigg_at_acxiom.com> wrote in article <5tf4dm$384_002_at_conway.acxiom.com>...
> Hello all,
> I am trying to write my first database trigger. Basically, on insert of
 a
> table, I want to insert values on each row to 2 other tables. When I
 run
> this script in SQL Plus, I get a warning: trigger created with
 compilation
> errors.
>
> Here is the code:
>
> create trigger trig_address_load
> after insert on address_load
> for each row

DECLARE
        iAddressID NUMBER ;         

>
> begin

        iAddressID := seq_address_id.nextval ;

> insert into address
> values(/* seq_address_id.nextval*/

 iAddressID,:new.zip_book,:new.room,NULL,NULL,:new.
> street_directional,
> :new.street_number,:new.street_name,:new.rural_route_address,:new.
 stated_community,
> :new.po_box_number,NULL,:new.fire_locator,NULL);
>
> insert into address_associations
>

values(:new.book_book_number,:new.book_book_pub_date,:new.listing_number,:ne w.
> section_number,
> :new.page_number,/* seq_address_id.currval */ iAddressID,NULL);
>
> end;
>
> /
>
> I have been following some examples in Oracle: The complete reference,
 and
> can't see where the problem is....
>
> Any and ALL suggestions welcomed!!
>
> Kelly
> kgrigg_at_acxiom.com
>
> ps. Please CC by mail too, our newsfeed here isn't very reliable
>
>
> "If you've had half as much fun as me...
> ....Then I've had twice as much fun as you!!"
>
> kgrigg_at_acxiom.com
> cayenne_at_cei.net
>
> Visit my Website at: http://www.cei.net/~cayenne/index.html
>
  Received on Fri Aug 22 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US