DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old November 6th, 2006, 02:01 PM
neodaba neodaba is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 2 neodaba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 11 m 49 sec
Reputation Power: 0
Dyanmic query help

Hi,
I'm having trouble getting this stored procedure to run:

CREATE PROCEDURE FOO ( )
LANGUAGE SQL
BEGIN
DECLARE FED_NAME VARCHAR(20);
DECLARE ID INTEGER;
DECLARE END_TABLE INT DEFAULT 0;
DECLARE STMT CHAR(100);
DECLARE C1 CURSOR FOR SELECT REMOTEID, OUT_SERVERNAME||'.SYSVERSIONS' FROM BAR.BLAH WHERE REMOTEID > 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET END_TABLE = 1;
OPEN C1;
FETCH C1 INTO ID, FED_NAME; WHILE END_TABLE = 0 DO SET STMT = 'UPDATE NSTANFORD.FOO SET C=(SELECT VERSIONNUMBER FROM ?) WHERE A=?';
PREPARE S1 FROM STMT;
EXECUTE S1 USING FED_NAME,ID;
FETCH C1 INTO ID, FED_NAME;
END WHILE; CLOSE C1; END

This is the error message I get "An unexpected token "SELECT VERSIONNUMBER FROM" was found following "STANFORD.FOO SET C=(". Expected tokens may include: "<space>". SQLSTATE=42601"

I get this error when I call the stored procedure. Any help would be great.
Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Dyanmic query help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway