Re: Triggers



On Thu, 26 Feb 2009 09:01:50 -0800 (PST), "amerar@xxxxxxx"
<amerar@xxxxxxx> wrote:


Hi,

We are making some changes and I'd like to know if this can be done
with a trigger.

I have Table1 which is the master table and Table2 which is the
history table. Currently we have over 100 places where Table1 is
inserted to and deleted from. After that Table2 is dealt with.

The table structures are a bit different and a couple of the columns
in Table2 come from stored procedure variables.

What we want it to put a trigger one Table1 to do the insert into
Table2 for us. This will fix any chances that Table1 is changed
without Table2 being changed also.

Since Table2 has a different structure and 2 columns come from
procedure variables, how can I access those variables?

We do not want to go to 100 places and update everything. Also, this
does away with the trigger and the tables can become out of sync....

Thanks!

Put the 'procedure variables' or whatever they may be, in a package
spec, and write a get_<variable> function to retrieve them, and a
put>_<variable> procedure to assign them. Pretty basic stuff.

--


Sybrand Bakker
Senior Oracle DBA
.



Relevant Pages

  • Re: Key Fields
    ... Just watch out of there's a foreign key that references the table. ... A traditional trigger will ... >> Table1 has an IP Address field ... >> All records in Table2 that have the foreign key set to the original IP ...
    (microsoft.public.sqlserver.programming)
  • Re: Triggers
    ...  Currently we have over 100 places where Table1 is ... in Table2 come from stored procedure variables. ... does away with the trigger and the tables can become out of sync.... ...
    (comp.databases.oracle.server)
  • Re: Create Delete Trigger on Table1 to Update a filed on Table2
    ... I am trying to create a DELETE Trigger. ... Update Table2 ... were deleted on Table1, so to only update date_removed filed for them ... My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis ...
    (comp.databases.ms-sqlserver)
  • Triggers
    ... I have Table1 which is the master table and Table2 which is the ... After that Table2 is dealt with. ... in Table2 come from stored procedure variables. ... What we want it to put a trigger one Table1 to do the insert into ...
    (comp.databases.oracle.server)
  • Re: Tricky Visual Basic Code help...
    ... moves the current record into a new record in table2. ... this with a little VBA code and a couple custom queries. ... Set a "pushFlag" column in the record in table1 to a specific ... If a duplicate is not found, ...
    (microsoft.public.access.formscoding)

Loading