473,770 Members | 6,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

25 New Member
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.REORGT S( )
DYNAMIC RESULT SETS 1
LANGUAGE SQL
MODIFIES SQL DATA

P1: BEGIN

DECLARE procresult RESULT_SET_LOCA TOR 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_LOCAT OR 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 3781
Remi
9 New Member
Hello, send you an example


CREATE PROCEDURE RACE.SP_LISTARP AISES6(
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
3803
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 generate a array of all those files and then in a loop request the version for each of those files. Now it randomly crashes with a error that it cannot write to memory at location xxxxxx. I cannot find the error and adding 'on error goto...
7
50955
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 wrote an INSERT statement that works fine however today I decided that as part of the application upgrade it should be return the record ID so I wrote the following which I admit is a little messy at places but it works. However when I added all...
3
59471
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: ORA-06550: line 10, column 19: PLS-00306: wrong number or types of arguments in call to '||'
5
3074
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 the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003
24
1452
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 snippet: #pragma once #include <string>
8
1079
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 doing wrong? Here it is... <html> <head> <script>
3
1546
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... I thought. The fields come and go, but something happens to the table formatting; on NS 7.1 and Firefox 1.0 it seems to miscount or hide the number of TD tags or something else confusing. Can anyone tell me what I'm doing wrong? -Paul
7
3291
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 "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
34
4517
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 write timers like this :
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10230
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.