473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

What is wrong with this Script? Problem with DECLARE etc, etc

25
Hi all,
My environment is DB2 UDBv8.2 on Windows and Linux.
I am getting a lot of errors on the script you see below. Some of the error I am geting are:


-----------------------------------Start of Script-----------------------------------
---------------------original creation by Norm Wong------------------------

CREATE PROCEDURE DB2ADMIN.REORGTS( )
DYNAMIC RESULT SETS 1
LANGUAGE SQL
MODIFIES SQL DATA

P1: BEGIN

DECLARE procresult RESULT_SET_LOCATOR VARYING ;

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "END-OF-STATEMENT" was found following "_SET_LOCATOR VARYING". Expected tokens may include: "<psm_semicolon>". LINE NUMBER=23. SQLSTATE=42601

DECLARE TABLE_SCHEMA VARCHAR(128) ;

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "DECLARE TABLE_SCHEMA VARCHAR" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". SQLSTATE=42601.
Same thig with all DECLARE shown below.

DECLARE TABLE_NAME VARCHAR(128) ;
DECLARE CARD INTEGER ;
DECLARE OVERFLOW INTEGER ;
DECLARE NPAGES INTEGER ;
DECLARE FPAGES INTEGER ;
DECLARE ACTIVE_BLOCKS INTEGER ;
DECLARE TSIZE INTEGER ;
DECLARE F1 FLOAT ;
DECLARE F2 FLOAT ;
DECLARE F3 FLOAT ;
DECLARE REORG CHAR(3) ;
DECLARE has_lob INTEGER DEFAULT 0 ;
DECLARE retval INTEGER DEFAULT 0 ;
DECLARE reorgcmd VARCHAR(512) ;
DECLARE at_end SMALLINT DEFAULT 0 ;
DECLARE not_found CONDITION FOR SQLSTATE '02000' ;
DECLARE CONTINUE HANDLER FOR not_found
SET at_end = 1 ;

Can someone show me what I am doing wrong? I need this help as soon as I can get it...
Thank you all
Okonita
Sep 12 '07 #1
1 3742
Remi
9
Hello, send you an example


CREATE PROCEDURE RACE.SP_LISTARPAISES6(
IN OPCION VARCHAR(2) ,
IN CODPAIS VARCHAR(3) ,
IN DENPAIS VARCHAR(30),
IN TIP VARCHAR(1)
)
LANGUAGE SQL
RESULT SETS 1
BEGIN
DECLARE SQLSELE1 CHAR(512);
DECLARE C1 CURSOR WITH RETURN FOR S1;
-- DEBERAN PASAR EL VALOR DE CODPAIS INCLUYENDO EL PORCENTUAL '02%'--
IF TIP = '1' THEN
SET SQLSELE1 = 'SELECT A .CODPAI , A . DENPAI , A . PFTPAI FROM RACE . YYYPAI A WHERE
A.CODPAI LIKE ? FETCH FIRST 5000 ROWS ONLY ';
ELSE
SET SQLSELE1 = 'SELECT A .CODPAI , A . DENPAI , A . PFTPAI FROM RACE . YYYPAI A WHERE
A.CODPAI LIKE ?
FETCH FIRST 5000 ROWS ONLY';
END IF;
PREPARE S1 FROM SQLSELE1;
OPEN C1 USING CODPAIS;
END;
Sep 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Fabster | last post by:
Below is a code part I got somewhere and works fine for retrieving a version from a single file. Now I want to retrieve all .dll, .ocx and ..exe file versions from my harddisk in all directory's. I...
7
by: Tim Gaunt | last post by:
Hi, I'm hoping that someone will be able to help me with this one, I'm developing an application which basically inserts a load of data into the database ready for validation at a later date, I...
3
by: Doron | last post by:
hi, getting the following error when running the script below. it seems to me that the cursor is retrieving more then one value each loop. any idea how to fix this? error: ERROR at line 10:...
5
by: wylbur37 | last post by:
How do you find out what version of JavaScript your browser supports? Is there a JavaScript function that will tell you? __________________________________ Do you Yahoo!? Find out what made...
24
by: Susan Baker | last post by:
Hi, I want to declare a variable of type (Vector of pairs) - Ok, I know this can be done using a map, but I want to keep things simple for now. I have declared the variable as ff in this code...
8
by: chris | last post by:
I'm trying to create a script that will cycle through a bunch of pics (1.jpg, 2.jpg, and so on up to 429.jpg) to make a movie. However, I can't get it to work. Could someone tell me what I'm...
3
by: P.Hill | last post by:
I have this simple bit of code that when you check a checkbox and it displays or hides two other fields (well actually two parts of the document with two different IDs. Pretty straight forward......
7
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with...
34
by: Jorge | last post by:
Why is it listed here : http://www.crockford.com/javascript/recommend.html under "deprecation" ? Without it, how is an anonymous function() going to call itself (recursively) ? I use to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.