Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trigger question 1

Status
Not open for further replies.

slok

Programmer
Jul 2, 1999
108
SG
I have a table as follows:

SQL> desc employee;
Name Null? Type
----------------------------------------- -------- ----------
EMP_NO NOT NULL NUMBER(4)
EMP_NAME NOT NULL CHAR(20)
EMP_SALARY NOT NULL NUMBER(8,2
EMP_SDATE NOT NULL DATE
DEPT_NO NOT NULL NUMBER(2)
ADDED_BY NOT NULL CHAR(20)


And a procedure Check_Delete as defined follows:
procedure Check_Delete (
p_user IN employee.added_by%type,
p_sysdate IN employee.emp_sdate%type)
as
===


How can I create a trigger that will called the procedure
Check_Delete before the actual delete?
 
create trigger <trigger-Name>
before delete on <any table namae other than the employee>
for each row
begin
check_delete:)old.emp_no,:eek:ld.emp_sysdate);
end;

You should make emp_no as a primary key and then do the following:

Create a temp table so that you have two field(the parameters which you have written in the procedure) and then
when you delete the id from the temp file then automatically it deletes the record from the employee table

Let me know if there is any problem

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top