statement.execute() returns error with Slash at the end of PL/SQL
When executing pl/sql im obtaining an error :
ORA-06550: line 1, column 316: PLS-00103: Encountered the symbol "/" The symbol "/" was ignored.
PLSQL example:
DECLARE
SQL1 VARCHAR2 (1500);
SQL2 VARCHAR2 (1500);
BEGIN
SQL1 := 'INSERT INTO das_html_caption VALUES (''test_test'')';
SQL2 := 'DELETE FROM das_html_caption where wording = ''test_test''';
EXECUTE IMMEDIATE SQL2;
EXECUTE IMMEDIATE SQL1;
EXECUTE IMMED开发者_StackOverflow中文版IATE SQL2;
COMMIT;
END;
/
Java:
Statement statement = dbConnection.createStatement();
ResultSet rs = null;
boolean ret = statement.execute( sql.getValue() );
is it correct error ? or i'm doing something wrong ?
Thanks
The slash is how you execute the anonymous block through an interactive environment such as SQL*Plus. If you are executing this block by a call from Java you don't need the terminating slash.
Found answer. Had to made more complcated request to google :)
As the message indicates, the compiler doesn't want to encounter the symbol "/", so just remove it. That simple. Let me explain. When using sqlplus or an SQL worksheet in sqldev, you do well appending your PL/SQL blocks with the slash. However, when using the procedure editor (native to sqldev), you'll have to remove it. Don't know why they made this set of rules, but until they relax them, we'll have to obey them ;-)
http://forums.oracle.com/forums/thread.jspa?threadID=519670
精彩评论