anupuspa
asked on
PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function package pragma procedure subt
Hi,
i hava a following Trigger given below.It gives error anyone can solve my problem please.
CREATE or replace TRIGGER t_before_delete_on_Qdefs
BEFORE DELETE ON QDEFS
FOR EACH ROW
declare varTotEstTime number(12,2);
Declare CURSOR c IS Select A.Sserial,A.Qserial,QSetsu m.TotEstTi me, B.EstTime from QSetDet A,Qdefs B,QSetSum Where A.Qserial=B.Qserial and a.SSerial = QSetSum.SSerial and B.QSerial =:old.qserial Order By a.Sserial,a.QSerial;
DECLARE PRAGMA AUTONOMOUS_TRANSACTIONS;
BEGIN
FOR J IN C LOOP
if (J.TotEstTime > 0 and J.EstTime > 0) then
varTotEstTime:=J.TotEstTim e-J.EstTim e
If varTotEstTime < 0 Then varTotEstTime = 0
update qsetsum set TotEstTime=varTotEstTime where SSERIAL=J.sserial;
DELETE FROM QSETDET WHERE QSERIAL =:OLD.QSERIAL;
DELETE FROM QDefs_PList WHERE QSERIAL =:OLD.QSERIAL;
end if;
END LOOP;
EXCEPTION
WHEN others THEN
raise;
END;
/
it will give error:
2/1 PLS-00103: Encountered the symbol "DECLARE" when expecting one of
the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> cursor
form current
i hava a following Trigger given below.It gives error anyone can solve my problem please.
CREATE or replace TRIGGER t_before_delete_on_Qdefs
BEFORE DELETE ON QDEFS
FOR EACH ROW
declare varTotEstTime number(12,2);
Declare CURSOR c IS Select A.Sserial,A.Qserial,QSetsu
DECLARE PRAGMA AUTONOMOUS_TRANSACTIONS;
BEGIN
FOR J IN C LOOP
if (J.TotEstTime > 0 and J.EstTime > 0) then
varTotEstTime:=J.TotEstTim
If varTotEstTime < 0 Then varTotEstTime = 0
update qsetsum set TotEstTime=varTotEstTime where SSERIAL=J.sserial;
DELETE FROM QSETDET WHERE QSERIAL =:OLD.QSERIAL;
DELETE FROM QDefs_PList WHERE QSERIAL =:OLD.QSERIAL;
end if;
END LOOP;
EXCEPTION
WHEN others THEN
raise;
END;
/
it will give error:
2/1 PLS-00103: Encountered the symbol "DECLARE" when expecting one of
the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> cursor
form current
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.