Home » SQL & PL/SQL » SQL & PL/SQL » why the trigger created with compile errors
why the trigger created with compile errors [message #231669] Wed, 18 April 2007 00:46 Go to next message
iitraghu
Messages: 18
Registered: April 2007
Location: bengalore
Junior Member

My aim was if i updated the rows in complex view it has effect
on the table from which the view was created.

here v1 is a view created from emp and dept tables.

1 create or replace trigger ins_of_upd_on_v1
2 instead of update on v1
3 for each row
4 begin
5 update emp set empno := :new.empno;
6* end;
SQL> /

Warning: Trigger created with compilation errors.


SQL> select * from v1;

EMPNO DEPTNO DEPTNO1
----- ------ -------
7369 20 20
7499 30 30
7521 30 30
7566 20 20
7654 30 30
7698 30 30
7782 10 10
7788 20 20
7839 10 10
7844 30 30
7876 20 20

EMPNO DEPTNO DEPTNO1
----- ------ -------
7900 30 30
7902 20 20
7934 10 10
1116 50 50

15 rows selected.

i want to update the last record in my view.
Re: why the trigger created with compile errors [message #231670 is a reply to message #231669] Wed, 18 April 2007 01:02 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
>i want to update the last record in my view.
"LAST" has NO context in any RDBMS.
A query returns a collection of records; none of which is "last".
Re: why the trigger created with compile errors [message #231671 is a reply to message #231670] Wed, 18 April 2007 01:19 Go to previous messageGo to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

hi,

check this link
regards
shanth
Re: why the trigger created with compile errors [message #231674 is a reply to message #231669] Wed, 18 April 2007 01:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What returns "show error"?

Regards
Michel
Re: why the trigger created with compile errors [message #231685 is a reply to message #231674] Wed, 18 April 2007 02:10 Go to previous messageGo to next message
iitraghu
Messages: 18
Registered: April 2007
Location: bengalore
Junior Member

SQL> /

Warning: Trigger created with compilation errors.


Re: why the trigger created with compile errors [message #231688 is a reply to message #231685] Wed, 18 April 2007 02:14 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
That is not what Michel asked.
Re: why the trigger created with compile errors [message #231692 is a reply to message #231669] Wed, 18 April 2007 02:25 Go to previous messageGo to next message
iitraghu
Messages: 18
Registered: April 2007
Location: bengalore
Junior Member

i got it,

just i wrote syntax error,

for the equal symbol
Re: why the trigger created with compile errors [message #231697 is a reply to message #231692] Wed, 18 April 2007 03:21 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
You do know that you lack a where clause and what consequences that has, right?
Re: why the trigger created with compile errors [message #231706 is a reply to message #231669] Wed, 18 April 2007 03:52 Go to previous messageGo to next message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
It may be the intent - to update all rows with the same employee id.
Re: why the trigger created with compile errors [message #231712 is a reply to message #231706] Wed, 18 April 2007 04:09 Go to previous message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No it was not.
The OP clearly said he wants to update the "last" row and as Ana said, "last" is meaningless.

Regards
Michel

Previous Topic: Comparing two attributes based on another one
Next Topic: WRITE BLOB INTO PDF
Goto Forum:
  


Current Time: Thu Dec 08 00:28:07 CST 2016

Total time taken to generate the page: 0.09450 seconds