473,372 Members | 1,143 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,372 software developers and data experts.

Not able to assign select query "WITH UR" CLUSE TO A VARIABLE

Hi,
i'm using Db2 Version 8.2.

in a stored procedure i'm assiging a the result of sql query ( with
"WITH UR" ) to a variable as shown below.
SET v_temp = ( SELECT 1 FROM
Table_1 A , Table_2 B
WHERE a.cd=b.cd )
WITH UR;

But i'm getting the fallowing syntax error.

An unexpected token "WITH UR" was found following " ". Expected
tokens may include: "<space>". LINE NUMBER=91. SQLSTATE=42601

i even tried to put that cluase inside the bracket but no luck.

can any body please suggest be the work around for this.

Thanks,
Situ
Jun 27 '08 #1
3 4802
(I didn't tested following opinion.
I was only refered the manuals
"DB2 for LUW SQL Reference Volume 1 Version 8" and
"DB2 for LUW SQL Reference Volume 2 Version 8".)

1) Your SET statement violates the following syntax of SET statement
and "fullselect".

SET (variable1, variable2, ..., variablen) = (row-fullselect);
or
SET variable = expression;
"expression" includes (scalar-fullselect).

You can't specify "isolation-clause" in a "fullselect".

Please try:
SELECT 1 INTO v_temp
FROM Table_1 A , Table_2 B
WHERE a.cd = b.cd
WITH UR;

2) I afraid that the SELECT statement may return multiple rows, and
get error.
If there is such possibility, it would be better to add "FETCH FIRST 1
ROW ONLY".
Jun 27 '08 #2
On May 9, 5:03*pm, Tonkuma <tonk...@fiberbit.netwrote:
(I didn't tested following opinion.
*I was only refered the manuals
*"DB2 for LUW SQL Reference Volume 1 Version 8" and
*"DB2 for LUW SQL Reference Volume 2 Version 8".)

1) Your SET statement violates the following syntax of SET statement
and "fullselect".

SET (variable1, variable2, ..., variablen) = (row-fullselect);
or
SET variable = expression;
"expression" includes (scalar-fullselect).

You can't specify "isolation-clause" in a "fullselect".

Please try:
SELECT 1 INTO v_temp
* FROM Table_1 A , Table_2 B
*WHERE a.cd = b.cd
* WITH UR;

2) I afraid that the SELECT statement may return multiple rows, and
get error.
If there is such possibility, it would be better to add "FETCH FIRST 1
ROW ONLY".
Thanks u very much , it worked !!
Jun 27 '08 #3
situ wrote:
Hi,
i'm using Db2 Version 8.2.

in a stored procedure i'm assiging a the result of sql query ( with
"WITH UR" ) to a variable as shown below.
SET v_temp = ( SELECT 1 FROM
Table_1 A , Table_2 B
WHERE a.cd=b.cd )
WITH UR;

But i'm getting the fallowing syntax error.
The SET statement does not support the isolation clause
i even tried to put that clause inside the bracket but no luck.
That would be isolation clause in a subquery, presently not supported
can any body please suggest be the work around for this.
Try SELECT INTO, or using a (one row) cursor

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 27 '08 #4

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

Similar topics

3
by: John Gibson | last post by:
Hi, all. I read that the "--with-perl" option "Build the PL/Perl server-side language". Does that mean the the switch is necessary to connect to the PostgreSQL database if you are using a perl...
0
by: 4.spam | last post by:
Hello. W2K, DB2 ESE V8.2.1 I created a dummy sql sp that returns 2 result sets. One of cursors inside it I declared as "with hold with return" and another as "with return" (without "with...
2
by: Griff | last post by:
Hi I'm a VB6 developer attempting to learn C# ....and I've stumbled at the first hurdle of how to use with blocks. I'm used to writing: Dim o as someObject with o.mainProperty
5
by: Alexander Myodov | last post by:
Hello, Having heard that Python 2.5 offers some kind of RIIA concept via PEP343, got it downloaded (Windows version) and tried. But it did not work as expected and as wanted. For the time since...
4
by: darrell | last post by:
I recently wrote a program in Access VBA that contains this snippet of code: For i = 1 to TotalBanks With Me("txtBank" & Chr(i + 64)) .BackColor = vbBlue .ForeColor = vbWhite End With Next i...
10
by: tsmithnj | last post by:
Why wouldn't the "WITH UR" SQL construct work in a UDF? Is the expectation to set it from the calling SQL?
3
by: vbace2 | last post by:
Hi. I am using DB2 v9.1 fixpack 2. I was wondering if there is a way to use the with hold option when using the prepare statement. Or, is there another way that I can do what I need to? I...
1
FLEB
by: FLEB | last post by:
Something in my gut tells me this is an FAQ, but my furious Googling thus-far hasn't found the answer (Biggest problem? The terms I'm looking for are in the license itself. Search, and... get... 50...
0
by: CatchSandeepVaid | last post by:
Product and ProductBasic has one-to-one relationship Product ---> ProductID <<PK>> ProductBasic ----> ProductId, useCode, StartTime as composite key..... this startTime's value will be known as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.