Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling a function from Groovy Sql
    primarykey
    data
    text
    <p>I am trying to call a function in Oracle that truncates the table name I pass in. Unfortunately, I keep getting the following error and have no clue as to why.</p> <pre><code>WARNING: Failed to execute: {? = call trunc_table(?)} because: Invalid column type java.sql.SQLException: Invalid column type at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:147) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:209) at oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3462) at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:126) at oracle.jdbc. </code></pre> <p>I am able to select rows from the table and print to the console. Also, I was able to call the dbms_utility.get_time() function with no problems. </p> <p>Here is the offending code.</p> <pre><code> def storedProcCall = """{? = call trunc_table(?)}""" sql.call(storedProcCall, [Sql.BOOLEAN, 'YFS_ZIP_CODE_LOCATION']) { println it } </code></pre> <p>I expect to get back a true or false to find out if the function was successful</p> <pre><code>create or replace FUNCTION TRUNC_TABLE (table_name IN VARCHAR2) RETURN BOOLEAN IS cid INTEGER; -- Cursor ID. BEGIN cid := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(cid, 'TRUNCATE TABLE ' || table_name, dbms_sql.native); DBMS_SQL.CLOSE_CURSOR(cid); RETURN TRUE; EXCEPTION WHEN OTHERS THEN DBMS_SQL.CLOSE_CURSOR(cid); dbms_output.put_line('Error truncating table: '||table_name); dbms_output.put_line(SQLERRM); RETURN FALSE; END TRUNC_TABLE; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload