473,406 Members | 2,713 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,406 software developers and data experts.

Declare variables and assigning in SP's

Hi,

while trying to read data from a table assigning values into more than
one value I stopped at the following problem:

declare c1 cursor for
select val1 into cval1, val2 into cval2
from inst1.table
where CUSID = iCUSID;

The db2 tells me that he expects "from" after "cval1". This means for me I
can't request more than one value in one query. But this should be bullsh..,
if it can't - and I think it will work, but how?
Does anyone know how?!?

Greetings from Cologne
Bas

Oct 2 '06 #1
2 1568
Hi,
>
while trying to read data from a table assigning values into more than
one value I stopped at the following problem:
Thanks for reading.

I had enougth time to solve the problem by myself.
For futher reading please use this:

declare cCol1 char(1);
declare cCol1 char(8);

declare c2 cursor for
select col1, col2
from inst1.table
where CUSID = iCUSID;

open c1;
fetch c1 into cCol1, cCol2;
close c1;

Greets
Bas
Oct 2 '06 #2
Hi, Bas:

If you're only expecting a singleton, a cursor is not necessary--and
will be unnecessarily costly. The general syntax for what you're trying
to do is:

select val1, val2 into cval1, cval2
from inst1.table
where CUSID = iCUSID;

Regards,

--Jeff

Sebastian Moderlak wrote:
Hi,

while trying to read data from a table assigning values into more than
one value I stopped at the following problem:

Thanks for reading.

I had enougth time to solve the problem by myself.
For futher reading please use this:

declare cCol1 char(1);
declare cCol1 char(8);

declare c2 cursor for
select col1, col2
from inst1.table
where CUSID = iCUSID;

open c1;
fetch c1 into cCol1, cCol2;
close c1;

Greets
Bas
Oct 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David T. Ashley | last post by:
Hi, In my project, I typically declare and define variables in the .H file, i.e. DECMOD_MAIN UINT8 can_message_201_status_global #ifdef MODULE_MAIN = HAS_NEVER_BEEN_RECEIVED #endif ;
6
by: rick | last post by:
Noob problem. I prefer to keep all my scripts in an external '.js' file. I am currently loading the external '.js' file from the header. Problem is I would like to declare a global variable in the...
6
by: Jason Shohet | last post by:
2 questions for anyone who can answer: 1. in class declarations, I realize you have to use the NEW keyword if you want to declare & instantiate some class at the same time. Whats an advantage...
9
by: Javaman59 | last post by:
Using local declarations within a block often makes code more readable, but is it less efficient? eg... void P() { while (...) { int i = ...; bool b = ...; .... } }
41
by: Miguel Dias Moura | last post by:
Hello, I am working on an ASP.NET / VB page and I created a variable "query": Sub Page_Load(sender As Object, e As System.EventArgs) Dim query as String = String.Empty ... query =...
20
by: John Wildes | last post by:
Hello How do I pass a variable containing data to an SQL Query. Here is my query >>> SELECT trn_date AS `Transaction Date`, item AS `Item Number`, type AS `Policy Type`, pol AS `Policy...
10
by: Charles O'Flynn | last post by:
As a complete newcomer (2-3 days) to PHP, although not to programming in general, I have 'dived in' to start a small project to read and parse an XML data stream. I have already worked out most of...
5
by: dancer | last post by:
Using ASP.net 1.1 and VB Is it possible to declare variables in their own subroutine? I had my DIM statements within a sub that worked just fine. I wanted to be able to use them in another...
20
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
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,...
0
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...

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.