Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers from SQL SERver to Oracle
your code might look like
create sequence Survey_series_sequence_id; /
CREATE or replace TRIGGER InsertSeries
before INSERT
on Survey_Series
for each row
begin
:new.Update_datetime := sysdate;
:new.Update_username := user;
select Survey_series_sequence_id.nextval() into
:new.Survey_series_sequence_id from dual;
end;
/
so it's slighly different.
check the doku/google on sequences.
you might have an problem there.
hth.
s.kapitza
rdalfonso_at_nyc.rr.com (Rich D) wrote in message news:<196cd325.0209181223.2907c569_at_posting.google.com>...
> I have a bunch of triggers in SQl Server that I need to move over to
> Oracle 8i.
>
> But when I run it in Sql Plus I get nowhere. Any thoughts on why this
> doesn;t work or general syntax differences (declaring variables, etc)
> between SQl Server and Oracle
>
> my trigger is:
>
> CREATE TRIGGER InsertSeries ON dbo.Survey_Series
> FOR INSERT
> AS
> DECLARE
> @Prevmax_id int,
> @Survey_series_id int
>
> SELECT @Prevmax_id = 0
>
> SELECT @Survey_series_id = Survey_series_id FROM inserted
>
> SELECT @Prevmax_id = MAX(Survey_Series.Survey_series_sequence_id)
> FROM Survey_Series
>
> UPDATE Survey_Series SET
> Survey_series_sequence_id = @Prevmax_id + 1,
> Update_datetime = getdate() ,
> Update_username = app_name()
> WHERE Survey_series_id = @Survey_series_id
>
> Thanks,
> rdalfonso_at_nyc.rr.com
Received on Thu Sep 19 2002 - 04:29:25 CDT
![]() |
![]() |