Menu

#1054 Some comments raise SQL Exception in CREATE PACKAGE

open
nobody
5
2021-09-02
2012-10-12
David Pinho
No

I'm seeing a strange behavior (well strange for me anyway). When
creating a package in an Oracle DB:

If i execute this in SQuirreL:

CREATE OR REPLACE PACKAGE foo AS

/* comment */
c1 CONSTANT INTEGER := 1;

FUNCTION f1 (arg1 IN NUMBER, arg2 IN DATE) RETURN INTEGER;

END foo;
/

It will execute fine and create the package. But if i change the
position of the comment line:

CREATE OR REPLACE PACKAGE foo AS

c1 CONSTANT INTEGER := 1;
/* comment */

FUNCTION f1 (arg1 IN NUMBER, arg2 IN DATE) RETURN INTEGER;

END foo;
/

it will fail with the error:
Query 1 of 4, Rows read: 0, Elapsed time (seconds) - Total: 0.02, SQL
query: 0.02, Reading results: 0
Error: Invalid SQL type: sqlKind = 0
SQLState: 99999
ErrorCode: 17439
Position: 0
Error occured in:
/* comment *

If i run it in Oracle SQLPlus it will run just fine.

I'm using Oracle 10.2.0.4.0 and SQuirreL 3.4.0 (with JDK 6 and JDK7, both with ojdbc5.jar and ojdbc6.jar).

Stacktrace from SQuirreL logs:

2012-10-12 16:17:28,429 [Thread-5] ERROR net.sourceforge.squirrel_sql.client.session.MessagePanel - privateShowMessage: Exception was Warning: execution completed with warning
java.sql.SQLWarning: Warning: execution completed with warning
at oracle.jdbc.driver.DatabaseError.addSqlWarning(DatabaseError.java:945)
at oracle.jdbc.driver.DatabaseError.addSqlWarning(DatabaseError.java:993)
at oracle.jdbc.driver.DatabaseError.addSqlWarning(DatabaseError.java:1008)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:220)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1909)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1871)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:318)
at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.processQuery(SQLExecuterTask.java:410)
at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.run(SQLExecuterTask.java:220)
at net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
at java.lang.Thread.run(Unknown Source)

Discussion

  • David Pinho

    David Pinho - 2012-10-12

    So anyway i pulled the source and the following seems to fix it:

    ### Eclipse Workspace Patch 1.0
    #P oracle
    Index: src/main/java/net/sourceforge/squirrel_sql/plugins/oracle/tokenizer/OracleQueryTokenizer.java
    ===================================================================
    --- src/main/java/net/sourceforge/squirrel_sql/plugins/oracle/tokenizer/OracleQueryTokenizer.java (revision 6682)
    +++ src/main/java/net/sourceforge/squirrel_sql/plugins/oracle/tokenizer/OracleQueryTokenizer.java (working copy)
    @@ -239,7 +239,7 @@
    for (Iterator<String> iter = _queries.iterator(); iter.hasNext();)
    {
    String next = iter.next();
    - if (next.startsWith(sep))
    + if (next.startsWith(sep) && !next.startsWith("/*"))
    {
    tmp.add(sep);
    String[] parts = next.split(sep + "\\n+");

    Tell me what you think

     
  • sfst

    sfst - 2021-09-01

    Neat observation.

    I am here, because a co-worker got "Error: Invalid SQL type: sqlKind=UNINITIALIZED
    SQLState:99999
    ErrorCode:17439".
    I got the error demonstrated multiple times, but I cannot reproduce that problem, despite using the same SQuirreL version 4.2.0 and pasting the same command (we are both on Windows). But I am using OpenJDK and the co-worker is still on Oracle Java and we found that NOT sticking a multi line comment to the SQL command fixed the problem for the co-worker.

    So, this threw the error for the co-worker, AFTER the file was completely extracted (I got the same file, but no error message):

    --single line comment
    / multi line comment
    multi line comment
    /
    --another comment
    @file 'some filename'
    SQL command

    This worked fine for both of us:

    --another comment
    @file 'some filename'
    SQL command

    The co-worker was in a rush, but If I can get hold of the computer again, what should I check for? (OJDBC driver and plugins differences? trace log?)

    FYI: The package creation commands from the OP above do both work for me (Oracle 11.1)

     
  • Gerd Wagner

    Gerd Wagner - 2021-09-02

    On 01.09.21 09:46 sfst:

    The co-worker was in a rush, but If I can get hold of the computer
    again, what should I check for? (OJDBC driver and plugins differences?
    trace log?)

    FYI: The package creation commands from the OP above do both work for me
    (Oracle 11.1)

    Drivers and logs are good to check.
    As you have the same SQuirreL version you should have the same version of the Oracle Plugin so I don't expect a problem there.

    You could compare
    - menu File --> Global Preferences --> tab Oracle
    - Alias Schema properties

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.