Re: Can this be done with a trigger?

From: Aya the Vampire Slayer <>
Date: Tue, 5 Aug 2008 17:16:24 +0000 (UTC)
Message-ID: <g7a1t8$3uj$> wa:
>The SOURCE is not needed in this table. But, this would fire the
>trigger where SOURCE is needed. The SOURCE will be derived within the
>PL/SQL code. I do not think this is possible. I may have to let the
>trigger fire, then go back and update the row.....

Create a View on Table1 selecting * from Table1 and also adding a null column called SOURCE at the end.

create or replace view vw_tbl1 as
  select t.*,

         null SOURCE
  from table1 t

Change your PL/SQL procedure to insert into the view instead of directly into the table, passing whatever it is that the PL/SQL is able to figure out for the SOURCE column as part of the INSERT parameters (since you are now inserting into the view where SOURCE exists as a column).

Then, create your trigger on the view and have the trigger insert all of the information into Table2, including the SOURCE column, after inserting into table1.

If you are worried about people inserting directly into the table, then simply deny access to the table and only allow access to the view. (here is me hoping you aren't letting users log in directly to the schema that contains all of these objects...)

"Care must be exorcised when handring Opiticar System as it is apts to
be sticked by dusts and hand-fat." --Japanese Translators

"Keep your fingers off the lens." --Elton Byington, English Translator
Received on Tue Aug 05 2008 - 12:16:24 CDT

Original text of this message