Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate a oracle db trigger using thin jdbc driver
    text
    copied!<p>currently I setting up a test environment for an application. I'm using jUnit and Spring in my test environment. Before a test execution I want to set up a database test environment state. I already has written the SQL scripts (schema and data) and they runs fine in Oracles SQLDeveloper. As I tried to execute them by using the oracle thin jdbc driver, the execution fails. It looks like that the thin driver doesn't like create trigger statements. </p> <p>I read that I have to use an oci driver instead of thin driver. The problem with the oci driver is that it is not platform independent and it takes time to set it up.</p> <p>Example of my code: <pre><code>CREATE TABLE "USER" ( USER_ID NUMBER(10) NOT NULL, CREATOR_USER_FK NUMBER(10) NOT NULL, ... PRIMARY KEY (USER_ID) ); CREATE SEQUENCE SEQ_USER START WITH 1 INCREMENT BY 1; CREATE TRIGGER "USER_ID_SEQ_INC" BEFORE INSERT ON "USER" FOR EACH ROW BEGIN SELECT SEQ_USER.nextval INTO :new.USER_ID FROM DUAL; END;</pre></code></p> <p>If I execute the the trigger statement the execution fails, but I looks like that the first part of the query (CREATE TRIGGER "USER_ID_SEQ_INC" ... "USER" ... BEGIN ... FROM DUAL;) is executed successfully, but the trigger seems to be corrupt if I try to use it. The execution fail error comes with the second part of the statement END; "ORA-00900: invalid SQL statement".</p> <p>Do anyone know a solution for that problem? I just want to create a trigger with platform independent thin jdbc driver.</p> <p>Cheers!</p> <p>Kevin</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload