Friday, June 14, 2013

0 IBM Data Studio & Cursor

I am trying to use IBM data studio 3.1.1 to create the cursor but keep getting error.

The code is very simple .

CREATE TABLE T6 ( C1 INT, C2 CHAR(20));
 
INSERT INTO T6
  VALUES (1, 'A');
 
INSERT INTO T6
  VALUES (2, 'B');
 
INSERT INTO T6
  VALUES (3, 'C');
 
INSERT INTO T6
  VALUES (4, 'D');
 
INSERT INTO T6
  VALUES (5, 'E');
 
DECLARE CU1 CURSOR WITH HOLD FOR SELECT * FROM T6;
 
OPEN CU1;
 
FETCH CU1;
 
FETCH CU1;
 
FETCH CU1;
 
COMMIT;
 
FETCH CU1;
 
CLOSE CU1;

However, when  I declare the cursor , I will get the error

An unexpected token "DECLARE CU1 CURSOR WITH HOLD FOR SELECT * F" was found following "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<space>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.13.111

image

I can confirm the SQL terminate is set up properly.

image

The same code works fine form db2cmd.

image

I still can not find out why it does not work in Data studio

0 comments:

Post a Comment

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates