Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: What's wrong with the trigger?
Hi :)
One guess would be that u are using name Accept as your table name where this word ACCEPT is a reserved word for Oracle. It is a command to take user input in sqlplus.
Anyway after compiling the trigger when u get error. Issue the following command to know exactly what is the error. Copy the text between lines and save it as a script name usrerror.sql and when ever u get into the same situtation just fire away the script :)
Hope it helps u out.
acc pgsz number prompt 'Enter Page Size : '
set pages &pgsz
set pause on
set newpage 0
set verify off
acc objna char prompt 'Enter Object Name : '
acc objtyp char prompt 'Enter Object Type : '
acc spfna char prompt 'Enter Spool File Name : '
column Name format a15
column Type format a12
column Seq format 9999
column Line format 9999
column Pos format 9999
column Text format a30
spool &spfna
ttitle 'Object Errors'
break on owner skip 1
select Name, Type, Sequence Seq, Line, Position Pos, Text
from user_errors
where name like nvl(upper('&objna'),'%') and
type like nvl(upper('&objtyp'),'%')
order by 1,3,4
/
spool off
undefine pgsz
undefine spfna
undefine objna
undefine objtyp
set newpage 1
set pages 16
set pause off
set verify on
ttitle off
clear breaks
clear columns
In article <35dd7a7e.5674634_at_news.twsc.pouchen.com.tw>,
violin.hsiao_at_mail.pouchen.com.tw (Violin) wrote:
> Hello,
> I want to create a trigger for the next purpose:
> When I insert into ACCEPT,check the column value ORD_ISS of MORDER,
> if ORD_ISS is null,update MORDER set ORD_ISS = ACCEPT.ACCEPT_QTY;
> else update MORDER set ORD_ISS = ORD_ISS + ACCEPT.ACCEPT_QTY;
>
> And the script is:
> CREATE OR REPLACE TRIGGER INS_ACCEPT
> AFTER INSERT
> ON ACCEPT
> FOR EACH ROW
> DECLARE
> iss_temp NUMBER;
> accept_temp NUMBER;
> BEGIN
> SELECT ORD_ISS INTO iss_temp FROM MORDER
> WHERE (ORD_NO = :new.ord_no AND
> ORD_NUM = :new.ord_num);
> IF iss_temp IS NULL THEN
> UPDATE MORDER SET ORD_ISS = :new.accept_qty
> WHERE (ORD_NO = :new.ord_no AND
> ORD_NUM = :new.ord_num);
> ELSE
> accept_temp := :new.accept_qty;
> accept_temp := accept_temp + iss_temp;
> UDPATE MORDER SET ORD_ISS = accept_temp
> WHERE (ORD_NO = :new.ord_no AND
> ORD_NUM = :new.ord_num);
> END IF;
> COMMIT;
> END INS_ACCEPT;
> /
>
> But when I compile the script in SQL*Plus,there's an error:
> Warning: Trigger created with compilation errors.
> What's wrong with my trigger?
> Please give me some tips,Thank you in advance!
> Please Cc to : violin.hsiao_at_mail.pouchen.com.tw,Thank you :)
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Thu Aug 20 1998 - 01:10:34 CDT
![]() |
![]() |