Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Trigger help for Oracel newbie
Thanks Sybrand!
It seems that the 'new' data is a set of variables in Oracle, in Sybase it is effectively a temp table, hence my error.
Thanks again,
Rob
In article <970177971.14345.3.pluto.d4ee154e_at_news.demon.nl>,
"Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote:
> CREATE OR REPLACE TRIGGER sgus_cusip_to_ticketno
> BEFORE INSERT OR UPDATE OF ticket_no ON deals
> FOR EACH ROW
> BEGIN
> SELECT secissue.cusip
> into :new.ticketno
> FROM secissue
> WHERE secissue.thekey = :new.secissue
> END;
> The purpose of triggers is usually to populate columns of the
*current*
> table using complex rules.
> The new values of the columns are referred to as :new.<column name>
the old
> ones as :old.<column name>.
> You can assign new values to your columns *directly* (instead of using
> update, which isn't allowed either, as the table is *already*
participating
> in a transaction)
> Please refer to the application developers guide for further details
on
> triggers. If you don't have it, it's online at
http://technet.oracle.com
>
> "Robert Brown" <rob_99_at_my-deja.com> wrote in message
> news:8qvo40$6ei$1_at_nnrp1.deja.com...
> > Hi,
> >
> > I've been using Sybase for a few years and now I'm working on
Oracle,
> > so I need some help with translation.
> >
> > In particular, the following Create Trigger is giving me 'MGR-00072:
> > Warning: TRIGGER SGUS_CUSIP_TO_TICKETNO created with compilation
errors.
> > ' error message:
> >
> > CREATE OR REPLACE TRIGGER sgus_cusip_to_ticketno
> > BEFORE INSERT OR UPDATE OF ticket_no ON deals
> > FOR EACH ROW
> > BEGIN
> > UPDATE :new
> > SET ticket_no = ( SELECT secissue.cusip
> > FROM secissue
> > WHERE secissue.thekey = :new.secissue)
> > END;
> >
> > I then ran:
> > select Line, Position, Text from user_errors
> > where Name = 'SGUS_CUSIP_TO_TICKETNO'
> >
> > ... which gives me:
> > LINE POSITION
> > TEXT
> >
> > ---------- ----------
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Oct 03 2000 - 12:45:52 CDT