Home » SQL & PL/SQL » SQL & PL/SQL » urgent:Error in trigger .
urgent:Error in trigger . [message #208635] Mon, 11 December 2006 10:56 Go to next message
lunate
Messages: 74
Registered: October 2006
Location: Pakistan
Member

hi all ,
can some one help me in solving this problem .
this dirty code is not working Laughing

CREATE OR REPLACE TRIGGER COUNTING
AFTER INSERT ON MEMBER_MASTER
BEGIN
CURSOR S IS
SELECT LEADER_NO,APP_NO,YEAR FROM MEMBER_MASTER;
R S%ROWTYPE;
BEGIN
OPEN S;
LOOP
FETCH S INTO R;
EXIT WHEN S%NOTFOUND;
INSERT INTO LEADER_INFO VALUES
(R.LEADER_NO,R.APP_NO,R.YEAR);
END LOOP;
CLOSE S;
END;
END;


please tell me about my incorrect syntax or logical by which this code is generating errors.

like

Quote:
SQL> show errors
Errors for TRIGGER COUNTING:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/8 PLS-00103: Encountered the symbol "S" when expecting one of the
following:
:= . ( @ % ;

Re: urgent:Error in trigger . [message #208636 is a reply to message #208635] Mon, 11 December 2006 11:00 Go to previous messageGo to next message
Littlefoot
Messages: 20894
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You have one BEGIN-END pair too much and miss one DECLARE.
icon8.gif  Re: urgent:Error in trigger . [message #208638 is a reply to message #208636] Mon, 11 December 2006 11:07 Go to previous messageGo to next message
lunate
Messages: 74
Registered: October 2006
Location: Pakistan
Member

HI DEAR ,CAN U HELP ME WHERE I USE DECLARE IN ABOVE CODE.
actually i have a table leader_info with 3 fields.ok
and anothere table member_master with several fields.ok
i want to insert values of 'leader_no,app_no,years' in member_master into the fields of table 'leader_info'
i want to use trigger (after insert on member_master).but i was fialed to do so.i also tried to do as.
Quote:
CREATE OR REPLACE TRIGGER SAMI
AFTER INSERT ON MEMBER_MASTER
BEGIN
INSERT INTO LEADER_INFO VALUES(MEMBER_MASTER.LEADER_NO,
MEMBER_MASTER.APP_NO,MEMBER_MASTER.YEAR);
END;

but still got errors.


then i made the previous codes using cursor but it still contains errors.

regards.
Re: urgent:Error in trigger . [message #208639 is a reply to message #208636] Mon, 11 December 2006 11:11 Go to previous message
lunate
Messages: 74
Registered: October 2006
Location: Pakistan
Member

Yes i do it.
U r write ,sorry i don't what kind of silly logic was in my mind at that time .

thanx dear 'great foot'. Laughing

[Updated on: Tue, 12 December 2006 04:07] by Moderator

Report message to a moderator

Previous Topic: ORA-01438
Next Topic: How can I use variables in a from_clause?
Goto Forum:
  


Current Time: Mon Dec 05 09:17:26 CST 2016

Total time taken to generate the page: 0.05158 seconds