MySQL Forums
Forum List  »  Stored Procedures

Can I run a anomynous PLSQL code block
Posted by: scott
Date: December 03, 2005 06:49PM

hi,

Is it possible to run a block of anonymous pl/sql code using JDBC connector?


the code on the java client side is as follows:

StringBuffer strBuf = new StringBuffer();
strBuf.append("begin \n");
strBuf.append("declare outvalue binary(16); \n");
strBuf.append("set outvalue = binary('0'); \n");
strBuf.append("end; \n");

PreparedStatement preparedProc = m_conn.prepareStatement(strBuf.toString());
preparedProc.execute();


And this is the exception stack I got:

java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare outvalue binary(16);
set outvalue = binary('0');
end' at line 2
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:930)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:770)


Is this feature not supported?

thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Can I run a anomynous PLSQL code block
7274
December 03, 2005 06:49PM
2193
December 05, 2005 07:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.