Home » SQL & PL/SQL » SQL & PL/SQL » trigger (oracle 10g)
trigger [message #419999] Wed, 26 August 2009 07:37 Go to next message
rajasekhar857
Messages: 500
Registered: December 2008
Senior Member
create or replace trigger t1
after insert or update or delete on x
for each row
begin
insert into y (a,b) values(:new.a,:new.b);
end;

but here when i update old record should remove and new one willget insert.but when i update all rows are available.how to give condition for this.
Re: trigger [message #420005 is a reply to message #419999] Wed, 26 August 2009 08:54 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Your requirement is not clear.
Be more clear.
Use CODE tag for your coding portion.

regards,
Delna
Re: trigger [message #420010 is a reply to message #419999] Wed, 26 August 2009 08:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Re: trigger [message #420149 is a reply to message #419999] Thu, 27 August 2009 05:00 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
If you want the contents of table Y to mirror those of table X, then you'd be better of looking at creating a Materialized View

Re: trigger [message #420182 is a reply to message #419999] Thu, 27 August 2009 07:37 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
hi,

Two things needed

1. when you are deleting x table row, what could be the value of
:new.a and :new.b

2. did you tried with if inserting then ... if updating then
Previous Topic: Convert no rows returned to zero
Next Topic: query help
Goto Forum:
  


Current Time: Thu Dec 08 12:41:33 CST 2016

Total time taken to generate the page: 0.11443 seconds