[
https://issues.apache.org/jira/browse/GROOVY-7256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alan Hengle closed GROOVY-7256.
-------------------------------
Resolution: Not A Problem
Based on comments, this is not a groovy issue.
> Sql.execute() does not report errors in "create function"
> ----------------------------------------------------------
>
> Key: GROOVY-7256
> URL: https://issues.apache.org/jira/browse/GROOVY-7256
> Project: Groovy
> Issue Type: Bug
> Components: SQL processing
> Affects Versions: 2.3.9
> Environment: xubuntu linux, release 14.04 (trusty), kernel 3.13.0-40
> oracle (ojdbc6.jar) release 11g version 2
> java 1.8
> Reporter: Alan Hengle
> Labels: database, oracle
>
> 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:
> {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()
> {code}
> 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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)