- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- create trigger
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2006 07:54 PM
тАО05-11-2006 07:54 PM
when table1(live table) updates/changes rows done by the end user.
Can you give me specific example on how to create this trigger.
thanks you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2006 08:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2006 08:38 PM
тАО05-11-2006 08:38 PM
Re: create trigger
You can create a trigger that execute
implicitly when an INSERT, UPDATE, or DELETE statement is issued against
the associated table.
A trigger can be fired upon the execution of a SQL statement or by an event.
There are BEFORE triggers and AFTER triggers.
You require an AFTER trigger.
With an AFTER ROW trigger. -- Trigger action is executed after modifying each row and possibly applying appropriate integrity constraints (rows are locked).
Peter has given you the syntax above.
IA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2006 02:12 PM
тАО05-14-2006 02:12 PM
Re: create trigger
Below are my sample tables.
Im not sure if table2 is correct.
what do you mean by :new.data1, :old.data2 ?? is it a new/old columns in table2?
table1
CREATE TABLE TABLE1
(
POLNUM VARCHAR2(15 BYTE),
COVNUM NUMBER(4)
);
table2
CREATE TABLE TABLE2
(
NEW_POLNUM VARCHAR2(15 BYTE),
POLNUM VARCHAR2(15 BYTE),
NEW_COVNUM NUMBER(4),
COVNUM NUMBER(4)
);
thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2006 06:17 PM
тАО05-14-2006 06:17 PM
Re: create trigger
this will do an insert on table2 after an insert on table1.
Mind you the insert on table2 is very basic,
to give you an example. We just count a nextval
CREATE OR REPLACE TRIGGER table12_insert AFTER INSERT ON table1 FOR EACH ROW
begin
INSERT INTO table2( new_polnum, polnum, new_covnum, covnum ) VALUES ( new_polnum.NEXTVAL, 'table12_insert', :new.new_covnum);
end;
/
regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2006 08:23 PM
тАО05-14-2006 08:23 PM
Re: create trigger
:new.col_name refers to the new value being inserted into column "col_name" and :old.col_name refers to the existing value thats being overwritten or updated.
Hope this clarifies.
Best Regards
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 03:35 PM
тАО05-22-2006 03:35 PM