Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating PL/SQL procedure from Java
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 VanfleterenReceived on Thu Aug 01 2002 - 17:53:18 CDT
![]() |
![]() |