From torque-user-return-5802-apmail-db-torque-user-archive=db.apache.org@db.apache.org Wed Feb 16 10:48:21 2005 Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 34510 invoked from network); 16 Feb 2005 10:48:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Feb 2005 10:48:21 -0000 Received: (qmail 78131 invoked by uid 500); 16 Feb 2005 10:48:20 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 78109 invoked by uid 500); 16 Feb 2005 10:48:20 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 78079 invoked by uid 99); 16 Feb 2005 10:48:19 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtpout19.mailhost.ntl.com (HELO mta13-winn.mailhost.ntl.com) (212.250.162.19) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 16 Feb 2005 02:48:19 -0800 Received: from aamta07-winn.mailhost.ntl.com ([212.250.162.8]) by mta13-winn.mailhost.ntl.com with ESMTP id <20050216104815.XPUI11211.mta13-winn.mailhost.ntl.com@aamta07-winn.mailhost.ntl.com> for ; Wed, 16 Feb 2005 10:48:15 +0000 Received: from posborneltp ([80.3.121.56]) by aamta07-winn.mailhost.ntl.com with ESMTP id <20050216104815.OHQZ3971.aamta07-winn.mailhost.ntl.com@posborneltp> for ; Wed, 16 Feb 2005 10:48:15 +0000 Reply-To: From: "Paul Osborne" To: "'Apache Torque Users List'" Subject: RE: PL/SQL in generated Oracle scripts Date: Wed, 16 Feb 2005 10:48:12 -0000 Organization: Morley Computing Limited Message-ID: <002801c51415$04477db0$6601a8c0@posborneltp> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal In-Reply-To: X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Thanks Thomas,=20 Yes, I'm using Torque 3.1.1. So, I'll make the necessary changes to the templates.=20 Paul.=20 -----Original Message----- From: torque-user-return-5801-paul.osborne=3Dmorley-computing.co.uk@db.apache.o= rg [mailto:torque-user-return-5801-paul.osborne=3Dmorley-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" 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 =3D hwh > > torque.database =3D oracle > > torque.targetPackage =3D = com.channel4.projects.learning.hwh.torque > > torque.database.driver =3D oracle.jdbc.driver.OracleDriver > > torque.database.host =3D 127.0.0.1 > > torque.database.createUrl =3D jdbc:oracle:thin:@localhost:1521:dev8i > > torque.database.buildUrl =3D jdbc:oracle:thin:@localhost:1521:dev8i > > torque.database.default =3D hwh > > profile=3Doracle > > jcdAlias =3D default > > databaseName =3D ${torque.project} > > databaseUser =3D ${torque.database.user} > > databasePassword =3D ${torque.database.password} > > dbmsName =3D Oracle > > jdbcLevel =3D 3.0 > > jdbcRuntimeDriver =3D ${torque.database.driver} > > urlProtocol =3D jdbc > > urlSubprotocol =3D oracle:thin > > urlDbalias =3D 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