Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2006, 10:27 AM
Authorized User
 
Join Date: Aug 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default oracle trigger (how to move forward)

I have an oracle trigger that works fine when you manually run it. How can I take the following trigger and make it repeat instead of specifically copying it for each table. For instance..

I have to run this several times for each different 'company'.

accept compnum prompt 'Enter Company Number: '
define logging = "_logging" (CHAR)

create or replace trigger ttfacp100&compnum&logging
before insert on ttfacp100&compnum
for each row
declare
        logname varchar2(8);
begin
                select user into logname from dual;
        :new.t$logn := logname;
end;

/

----------------------------------------------------------------
I want to be able to have a list of companies that run the trigger each time it changes, but only call this script once.
Can something like this be done?

define logging = "_logging" (CHAR)
define compnum = 100
run.trigger()

define compnum = 200
run.trigger()

define compnum = 300
run.trigger()

run.trigger()
{
create or replace trigger ttfacp100&compnum&logging
before insert on ttfacp100&compnum
for each row
declare
        logname varchar2(8);
begin
                select user into logname from dual;
        :new.t$logn := logname;
end;
/
}


Thank you!
-Tim







Similar Threads
Thread Thread Starter Forum Replies Last Post
oracle database trigger jlnashrod Oracle 1 October 3rd, 2007 12:41 AM
Forward after Login ~Bean~ ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2005 05:14 PM
Oracle Trigger help please... tnzabo Oracle 1 March 2nd, 2005 06:05 AM
Forward booking rahilahmed Pro VB Databases 1 June 16th, 2004 06:02 PM
Forward Booking rahilahmed Excel VBA 0 May 24th, 2004 09:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.