db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Osborne" <paul.osbo...@morley-computing.co.uk>
Subject RE: PL/SQL in generated Oracle scripts
Date Wed, 16 Feb 2005 10:48:12 GMT

Thanks Thomas, 
Yes, I'm using Torque 3.1.1. So, I'll make the necessary changes to the
templates. 
Paul. 

-----Original Message-----
From:
torque-user-return-5801-paul.osborne=morley-computing.co.uk@db.apache.org
[mailto:torque-user-return-5801-paul.osborne=morley-computing.co.uk@db.apach
e.org] On Behalf Of Thomas Fischer
Sent: 16 February 2005 07:47
To: Apache Torque Users List
Subject: RE: PL/SQL in generated Oracle scripts





Hi Paul,

I suppose you use Torque 3.1.1. In that version, a change was introduced in
order not to let the "drop table" statements fail if the table is not
already there (e.g. if you start with an empty database). But this change
produces more problem than it solves, so I removed it again in CVS. In
particular, it produces invalid scripts which cannot be executed 'by hand'.

For oracle, please use the sql templates either from cvs HEAD or from
Torque 3.1. To do this, replace the directories templates/sql/base/oracle,
templates/sql/db-init/oracle, templates/sql/load/oracle and the file
templates/sql/id-table/id-table.oracle.

   Thomas

"Paul Osborne" <paul.osborne@morley-computing.co.uk> schrieb am 16.02.2005
00:29:55:

> 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)
>
> /
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message