If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Create temporary table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-04, 05:04
cesar cesar is offline
Registered User
 
Join Date: Feb 2003
Posts: 13
Create temporary table

Hello,

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

COM.ibm.db2.jdbc.DB2Exception: [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?

Thanks,

Cesar
Reply With Quote
  #2 (permalink)  
Old 01-15-04, 10:06
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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.

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On