Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: DB2 Statement Termination in SQL

  1. #1
    Join Date
    Aug 2007
    Posts
    2

    Default DB2 Statement Termination in SQL

    I'm using Spoon 2.5.0 with DB2 v9.1.

    I want to create a stored procedure in a SQL script.

    However, I get an error (sqlcode : -104 sqlstate : 42601) in the step. I think this is because of the statement termination character. In my DB2 client I need to change this from a semi-colon in order to create a procedure with a script.

    Is there any way in Spoon (either in the DB connection or the SQL script step?) where I can set the statement termination character?

    My create statement works fine in the DB2 client (with the terminator changed).

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    It's not really meant to execute ddl.

    Regards,
    Sven

  3. #3
    Join Date
    Aug 2007
    Posts
    2

    Default

    That's probably true, but it's not really a DDL issue.

    I run into the same problem if I try to execute an anonymous code block something like:

    begin
    declare some vars;
    select into some vars;
    insert using some vars;
    end

    DB2 isn't smart enough to figure out that the first ; isn't the end of the statement.

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    The job entry will split the sql statements on the ';'s itself... it will execute the following on any part it finds:

    Statement stmt = connection.createStatement();
    resultSet = stmt.execute(sqlStripped);

    where sqlStripped is one statement.

    Regards,
    Sven

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.