Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating PL/SQL procedure from Java

Re: Creating PL/SQL procedure from Java

From: Christophe Vanfleteren <cD0Tvanfleteren__at__SpaMndora.be>
Date: Thu, 01 Aug 2002 22:53:18 GMT
Message-ID: <yZi29.41221$8o4.5536@afrodite.telenet-ops.be>


Wolf wrote:

> Hi there,
>
> i have to create a PL/SQL procedure from my Java code. If i
> execute the code by connecting via JDBC to the Oracle 8.1.7.
> database, all works fine:
>
> For example,
> I do a stmt.execute("CREATE OR REPLACE FUNCTION getCalcul RETURN
> VARCHAR2 IS calcul VARCHAR2(2000); BEGIN calcul := 'Toto'; RETURN
> calcul; END;");
>
> Now i put the Java code inside the database via "loadjava" and connect
> with the default connection. Other SQL queries still work fine.
>
> When i execute the creation of my PL/SQL procedure, i get the
> following exception:
>
> BadExecuteException: Can't executeUpdate query-ORA-14552: DDL
> operation, COMMIT or ROLLBACK not allowed in an DML instruction.
>
> What's the clue here?
> Should'nt i use Statement.execute() but other things instead?
>
> Regards,
> Wolf.

Does setting autocommit to false on your connection work? Try something like conn.setAutoCommit(false) before you execute the statement.

-- 
Christophe Vanfleteren
Received on Thu Aug 01 2002 - 17:53:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US