Home » SQL & PL/SQL » SQL & PL/SQL » procedures
procedures [message #255069] Mon, 30 July 2007 10:00 Go to next message
madhu_msinus@yahoo.co.in
Messages: 12
Registered: July 2007
Location: usa
Junior Member
hi all,
i have a two tables called emploee1 and emploee2..
i am planning to insert a record in employee1...i am planning to write a procedure if emploee id >200 the record should be inserted in both the tables otherwise its only inserted in the employee1 ..
can any one tell me the logic for that...


thanks.
Re: procedures [message #255071 is a reply to message #255069] Mon, 30 July 2007 10:02 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
School work? What have you tried so far?

Please read and follow
http://www.orafaq.com/forum/t/59966/105378/
Re: procedures [message #255084 is a reply to message #255069] Mon, 30 July 2007 10:40 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use INSERT statement.

Regards
Michel
Re: procedures [message #255299 is a reply to message #255069] Tue, 31 July 2007 05:44 Go to previous messageGo to next message
iamdurai
Messages: 96
Registered: April 2007
Location: Chennai
Member

Hi,

I think this trigger will help you.

create or replace Trigger Tri_Check
after insert
on emp1
for each row
begin
if :new.empno >2000 then
insert into emp2
values(:new.empno,..........);
end if;
end tri_emp;


Reds
Thangam.
Re: procedures [message #255305 is a reply to message #255299] Tue, 31 July 2007 05:50 Go to previous message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can do it in one insert statement no need of a trigger.

Regards
Michel
Previous Topic: How to retrieve last record in a table...
Next Topic: Concatenation problem in stored procedure (merged by LF)
Goto Forum:
  


Current Time: Wed Dec 07 22:08:32 CST 2016

Total time taken to generate the page: 0.08051 seconds