Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.3.9
-
None
-
xubuntu linux, release 14.04 (trusty), kernel 3.13.0-40
oracle (ojdbc6.jar) release 11g version 2
java 1.8
Description
Attempt to create a function that contains a compile error using Sql.execute() and the error is not reported (i.e. no exception is thrown). When running the same "create" in SqlDeveloper connected to the same database, errors are shown.
Sample code:
import groovy.sql.Sql def driver = 'oracle.jdbc.pool.OracleDataSource' def url = ['jdbc:oracle:thin:@<ip_addr>:1521:<sid>', '<username>', '<pw>'] def sql = Sql.newInstance(*url, driver) try { sql.execute('drop function badfunc') } catch(Exception s) { println s.getMessage() } try { sql.execute(''' CREATE OR REPLACE FUNCTION badfunc RETURN NUMBER IS BEGIN RETURN whathaveyou; END; ''') } catch(Throwable t) { println t.getMessage() } println "create finished" sql.close()
result:
(shows error on "drop" the first time)
create finished
(the function exists afterward with an "INVALID" status)
result from SqlDeveloper:
Error(5,9): PLS-00201: identifier 'WHATHAVEYOU' must be declared