Skip to Main Content

Trigger help

user8015813Mar 28 2014 — edited Mar 28 2014

I have 2 tables which are my_school and my_class

And "my_school" table has 'info_id' column and also "my_class" table has 'info_id' then I want to get a query that automatically generate "info_id" then I found solution..

Here are my working TRIGGER on "my_school" table...

--------------------------------------------------------------

CREATE OR REPLACE TRIGGER info_id

  before insert on my_direction             

  for each row

begin  

if :NEW.WAY_ID is null then

    :NEW.WAY_ID := example_id_seq.nextval;

  end if;

  end;

/

--------------------------------------------------------------

It works and it's generating auto id when inserting value. But now how to get this trigger when users insert value then take id with my_school's "info_id" same time?

Comments
Post Details
Added on Mar 28 2014
3 comments
105 views