1

I'm not able to create triggers on the SQL Database Service on Bluemix. I always get the error message "queryExecFailure - Unupported SQL statement or command." Which is clear enough. Does someone got the same feedback ? Any option to activate triggers ?

Many thx

renaudb
  • 11
  • 1
  • What service do you use, free or premium? How did you execute the `CREATE TRIGGER`? – data_henrik Jan 07 '16 at 14:24
  • I'm using the free service and sending SQL command via the bluemix interface of the SQL Database service (SQL Database console -> Run queries). Query is the following : – renaudb Jan 20 '16 at 16:49
  • CREATE TRIGGER USER11266.CI_IT_VOITURESCAST after insert on USER11266.VOITURESCAST for each row begin insert into USER11266.CI_BT_VOITURESCAST ( IH_PK ,IH_OPERATION_NAME ,IH_FLAG ) values ( CI_SEQ_VOITURESCAST.nextval ,'INSERT' ,NULL ); end – renaudb Jan 20 '16 at 16:50
  • As I said in my answer, you cannot run DML through the query interface. – data_henrik Jan 24 '16 at 09:23

1 Answers1

1

There are several feature restrictions in the SQL DB service on Bluemix compared to a regular DB2 database. They depend on whether you use the free service or the premium service. In the free service the user is mapped to a schema within a DB2 database and only has basic privileges. This cuts down some possible use cases for triggers.

Creating triggers is DDL, not DML. Success creating them depends on how the statement is executed. The "Run Query" interface can only be used to execute SELECT statements. To run something like a trigger you would need to connect a SQL client (e.g., IBM Data Studio, SQuirreL, ...) to the database.

Also note the required privileges to create triggers. The power of triggers is limited to your schema within and your privileges.

data_henrik
  • 16,724
  • 2
  • 28
  • 49