eCharcha.Com   Support eCharcha.Com. Click on sponsor ad to shop online!

Advertise Here

Go Back   eCharcha.Com > Science and Technology > Computing

Notices

Computing All things binary...

Reply
 
Thread Tools Display Modes
  #1  
Old February 13th, 2004, 03:48 PM
Napolean Napolean is offline
Senior eCharchan
 
Join Date: Jul 2001
Posts: 8,914
Napolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond repute
How to get rid of Mutating table problem

I have to write an Oracle 8i database trigger which is an after insert trigger and it has to select the data from the same table on which it is fired .

so suppose I have a table a and I have written an after insert trigger on a.Now I want to examine the new value of a column in a and based on that I have to update some other table.
I know this is a difficult issue.Can anyone suggest some easy and quick solution???
Reply With Quote
  #2  
Old February 13th, 2004, 09:13 PM
Pappu Pager's Avatar
Pappu Pager Pappu Pager is offline
Junior eCharchan
 
Join Date: Jan 2004
Posts: 84
Pappu Pager is on a distinguished road
If you want to examine the new value inserted in the table A then use :new.colname instead of selecting the inserted value from the table

Example

create or replace trigger nepali
after insert on table A
for each row
begin
if :new.colname:='something' then
update B set col2='anything' where col1=:new.colname;
end if;
end;
Reply With Quote
  #3  
Old February 14th, 2004, 11:56 AM
Napolean Napolean is offline
Senior eCharchan
 
Join Date: Jul 2001
Posts: 8,914
Napolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond reputeNapolean has a reputation beyond repute
Quote:
Originally posted by Pappu Pager
If you want to examine the new value inserted in the table A then use :new.colname instead of selecting the inserted value from the table

Example

create or replace trigger nepali
after insert on table A
for each row
begin
if :new.colname:='something' then
update B set col2='anything' where col1=:new.colname;
end if;
end;
Thanks very much Pappu......
But you look familiar man..... reply to my PM...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A Table for Two Rakhi Recipe Corner 27 April 22nd, 2009 01:39 PM
Ethics of wiping boogers under the table! HarHarMahaDev Philosophy 4 September 20th, 2007 02:39 PM
I'm Swami Peerji I help you solve problems love problem relationship problem Swami Peerji SoapBox 30 June 24th, 2005 10:10 PM
I want this table Diplomat SoapBox 1 November 19th, 2003 10:50 AM


All times are GMT -7. The time now is 09:56 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Site Copyright © eCharcha.Com 2000-2012.