[ 
https://issues.apache.org/jira/browse/PHOENIX-932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13984791#comment-13984791
 ] 

alex kamil commented on PHOENIX-932:
------------------------------------

removed Java call,  for now it would be nice to match basic SQL trigger 
functionality as in Derby

> db triggers
> -----------
>
>                 Key: PHOENIX-932
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-932
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: alex kamil
>
> add a trigger feature similar to Apache Derby, calling a SQL statement on 
> DDL/DML changes
> Syntax:
> CREATE
>     TRIGGER trigger_name
>     trigger_time trigger_event
>     ON tbl_name
>     WHEN trigger_condition
>     FOR EACH ROW
>     CALL trigger_body
> trigger_time: { BEFORE | AFTER }
> trigger_condition: { condition AND|OR|NOT|>|<|= condition }
> trigger_event: { UPSERT|CREATE|ALTER|DROP|DELETE}
> trigger_body: { TRIGGERED_SQL_STATEMENT}
> TRIGGERED_SQL_STATEMENT:{UPSERT|CREATE|ALTER|DROP|DELETE}
> TRIGGERED_SQL_STATEMENT has the following limitations:
> It must not contain any dynamic parameters ( ? ).
> It must not create, alter, or drop the table upon which the trigger is 
> defined.
> It must not add an index to or remove an index from the table on which the 
> trigger is defined.
> It must not add a trigger to or drop a trigger from the table upon which the 
> trigger is defined.
> It must not commit or roll back the current transaction or change the 
> isolation level.
> It must not execute a CALL statement.
> BEFORE triggers cannot have INSERT, UPDATE or DELETE statements as their 
> action.
> Example: 
> CREATE TRIGGER  trigger1
> AFTER ALTER ON table1
> WHEN (table1.col1 > table1.col2)
> CALL UPSERT INTO table2(col1, col2) SELECT col3, col4 FROM table3
> References:
> http://db.apache.org/derby/docs/10.1/ref/rrefsqlj43125.html



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to