Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Converting MSSQL trigger stuff to Oracle???
Can answer the first question only.
If there are no updates or inserts to process the trigger won't fire.
This functionality will probably be present in SQL server 9:)
Hth,
Sybrand Bakker, Oracle DBA
Brad Pybus wrote in message ...
>
>I'm new to Oracle and new to SQL server. I need to convert some SQL Server
>trigger stuff to Oracle.
>
>I want to be able to do the following in Oracle:
>
>The trigger will be AFTER Updates and Inserts but I do not want to process
>the trigger if no rows
>were actually updated or inserted. How do I do this in Oracle?
>
>IF @@rowcount > 0
> ............
>END
>
>
>Can I use sql%rowcount? I seemed to get some indications from another post
>that this won't work.
>
>--------
>NEXT:
>
>If I have a trigger on TABLEA for insert, how do I convert the following to
>Oracle:
>
>UPDATE TABLEA
>SET MyDateField = getdate() FROM inserted
>WHERE TABLEA.PrimaryKey = inserted.Primarykey
>
>
>What baffles me is that I do not even understand the MS SQL being used here
>(I don't have an SQL reference handy). I assume "inserted" is some sort
of
>internal cursor that contains all the rows to be inserted. I do not see
>the point of the where clause. It seems to be saying... "only look at the
>records that are already in TABLEA". If rows are being inserted, how can
>they already be in TABLEA?
>
>--
>To reply to me, remove the "_nospam" from my address.
>
>
Received on Tue May 04 1999 - 13:50:14 CDT