db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <kristian.waa...@oracle.com>
Subject Re: Create trigger with 2 sql statements
Date Wed, 08 Sep 2010 15:39:34 GMT
  On 23.08.10 11:52, Andrzej Kasprzyszyn wrote:
> Hi All
>
> I would like to create following trigger
>
> CREATE TRIGGER COUNTRY_TRG
> AFTER INSERT ON COUNTRY
> DELETE FROM aTable WHERE table_name = 'country'
> INSERT INTO aTable(table_name, msg) VALUES('country', current_timestamp)
>
>
> I am receiving syntax error:
>
>   11:40:55  [CREATE - 0 row(s), 0.000 secs]  [Error Code: -1, SQL
> State: 42X01]  Syntax error: Encountered "INSERT" at line 4, column 1.
> ... 1 statement(s) executed, 0 row(s) affected, exec/fetch time:
> 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]
>
>
> Is it possible that Derby doesn't allow two sql statements in triggers action?

Hi Andrzej,

Yes, you can only specify a single SQL statement. If you want to do 
more, I think you have to write (and make available) a Java stored 
procedure and use CALL PROCEDURE in your trigger.


Regards,
-- 
Kristian

> Thanks in advance,
> Andrzej


Mime
View raw message