Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003

    Unanswered: Create temporary table


    I would like to create a temporary table from a Java application using JDBC 1.2.

    I used the following command:

    rs=stmt.executeQuery("DECLARE GLOBAL TEMPORARY TABLE tempTable LIKE me.myTable');

    But I'm getting the following error message [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "myTable" was found following "BLE tempTable LIKE me.". Expected tokens may include: "END-OF-STATEMENT". SQLSTATE=42601

    Does anybody have any idea?



  2. #2
    Join Date
    Jan 2003
    Provided Answers: 5
    First of all, the SQL looks OK. Does it work from the CLP?
    It looks like your quotes are wrong on the SQL string. It looks like you have a double quote (") at the front, and a single (') at the end (this maybe just a typo).

    I noticed that you are using ExecuteQuery to perform the operation. ExecuteQuery is only for SELECT statements since it returns a result set. Use ExecuteUpdate for all non-SELECT statements, including DDL statements.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts