Home » SQL & PL/SQL » SQL & PL/SQL » error in trigger
error in trigger [message #254015] Wed, 25 July 2007 08:58 Go to next message
madhu_msinus@yahoo.co.in
Messages: 12
Registered: July 2007
Location: usa
Junior Member
can any one help me out from this....

thanks.


SQL> create or replace trigger audit_emp
2 after delete or insert or update on employees
3 for each row
4 begin
5 insert into audit_emp(user_name,time_stamp,id,old_last_name,new_last_name,old_title,new_title,o
ld_salary,new_salary)
6 values(user,sysdate,:old.employee_id,:old.last_name,:new.last_name,:old.old_title,:new.new_titl
e,:old.old_salary,:new.new_salary);
7 end;
8 /

Warning: Trigger created with compilation errors.

SQL> show errors;
Errors for TRIGGER AUDIT_EMP:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/68 PLS-00049: bad bind variable 'OLD.OLD_TITLE'
3/83 PLS-00049: bad bind variable 'NEW.NEW_TITLE'
3/98 PLS-00049: bad bind variable 'OLD.OLD_SALARY'
3/114 PLS-00049: bad bind variable 'NEW.NEW_SALARY'
Re: error in trigger [message #254018 is a reply to message #254015] Wed, 25 July 2007 09:29 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
Try changing :old.old_title to :old.title etc etc
Re: error in trigger [message #254020 is a reply to message #254015] Wed, 25 July 2007 09:32 Go to previous messageGo to next message
madhu_msinus@yahoo.co.in
Messages: 12
Registered: July 2007
Location: usa
Junior Member
thanks for your help friends...i changed the query as you said but still i am getting error table does not exist..but i have the table employees.
can any one help me out from this..

thanks.

SQL> create or replace trigger audit_emp
2 after delete or insert or update on employees
3 for each row
4 begin
5 insert into audit_emp(user_name,time_stamp,id,old_last_name,new_last_name,old_title,new_title,o
ld_salary,new_salary)
6 values(user,sysdate,:old.employee_id,:old.last_name,:new.last_name,:old.job_id,:new.job_id,:old
.salary,:new.salary);
7 end;
8 /

Warning: Trigger created with compilation errors.

SQL> show errors;
Errors for TRIGGER AUDIT_EMP:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/1 PL/SQL: SQL Statement ignored
2/13 PL/SQL: ORA-00942: table or view does not exist
SQL> select * from employees;

Re: error in trigger [message #254023 is a reply to message #254020] Wed, 25 July 2007 09:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Either the table does not exist or you don't have direct access to it.

Regards
Michel
Re: error in trigger [message #254026 is a reply to message #254015] Wed, 25 July 2007 09:53 Go to previous message
BlackSwan
Messages: 25035
Registered: January 2009
Location: SoCal
Senior Member
Privs acquired via ROLE do not apply within PL/SQL procedures (including triggers)
Previous Topic: Get min and max dates by grouping dates with 30 day range
Next Topic: ORA-22905: cannot access rows from a non-nested table item
Goto Forum:
  


Current Time: Sat Dec 03 20:41:58 CST 2016

Total time taken to generate the page: 0.34842 seconds