I am trying to use the Maven Torque plugin to generate and initialize an
Oracle 8i database. However, the torque 'insert-sql' target is failing
because the generated SQL contains PL/SQL code, giving the error:
[torque-sql-exec] [ERROR] Failed to execute: DECLARE TABLE_DOES_NOT_EXIST
EXCEPTION. Am I using the wrong torque target to execute the scripts
The SQL scripts appear to be correct and work perfectly via sql*plus.
I've successfully managed to create the schema for MySQL without any
problems but am struggling with Oracle.
Any help would be greatly appreciated!
My properties are set as follows:
torque.project = hwh
torque.database = oracle
torque.targetPackage = com.channel4.projects.learning.hwh.torque
torque.database.driver = oracle.jdbc.driver.OracleDriver
torque.database.host = 127.0.0.1
torque.database.createUrl = jdbc:oracle:thin:@localhost:1521:dev8i
torque.database.buildUrl = jdbc:oracle:thin:@localhost:1521:dev8i
torque.database.default = hwh
profile=oracle
jcdAlias = default
databaseName = ${torque.project}
databaseUser = ${torque.database.user}
databasePassword = ${torque.database.password}
dbmsName = Oracle
jdbcLevel = 3.0
jdbcRuntimeDriver = ${torque.database.driver}
urlProtocol = jdbc
urlSubprotocol = oracle:thin
urlDbalias = dev8i
Sample of the generated SQL...
----------------------------------------------------------------------------
-
-- subject
----------------------------------------------------------------------------
-
DECLARE
TABLE_DOES_NOT_EXIST EXCEPTION;
PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE subject CASCADE CONSTRAINTS';
EXCEPTION
WHEN TABLE_DOES_NOT_EXIST THEN NULL;
END;
/
CREATE TABLE subject
(
id NUMBER (10) NOT NULL,
name VARCHAR2 (30) NOT NULL,
CONSTRAINT name_unique UNIQUE (name)
)
/
ALTER TABLE subject
ADD CONSTRAINT subject_PK
PRIMARY KEY (id)
/