Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger creates without compilation error but while running shows errors

Re: Trigger creates without compilation error but while running shows errors

From: Andy Hassall <andy_at_andyh.org>
Date: Tue, 19 Nov 2002 21:33:29 +0000
Message-ID: <fdbltuo5a83g9lrape6kt5g2qhsadb712f@4ax.com>


On Tue, 19 Nov 2002 20:24:57 GMT, "gamaz" <gamaz_at_eathlink.net> wrote:

>I have created a trigger that would not allow any insert or delete on a
>emp_test table from now on.(The table already has values inside). While
>creating the trigger it does not give error. However, while trying to delete
>one record it is showing errors.

 Isn't that exactly what you wanted?

>create trigger emp_test_IDtg
>before insert or delete on emp_test
>for each row

<snip>

>WHEN INSERT_DELETE_ERROR THEN
>RAISE_APPLICATION_ERROR (-20001, 'Inserting or deleting not allowed at this
>stage');
>

 i.e. raise an error if you insert or delete.

>SQL> delete from emp_test where empno = 7900;
>delete from emp_test where empno = 7900
> *
>ERROR at line 1:
>ORA-20001: Inserting or deleting not allowed at this stage
>ORA-06512: at "SCOTT.EMP_TEST_IDTG", line 11
>ORA-04088: error during execution of trigger 'SCOTT.EMP_TEST_IDTG'

 You tried to delete - so it raised the error you told it to.

-- 
Andy Hassall (andy@andyh.org) icq(5747695) http://www.andyh.org
http://www.andyhsoftware.co.uk/space | disk usage analysis tool
Received on Tue Nov 19 2002 - 15:33:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US