473,769 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4833
(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...@fiberb it.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
1675
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 program? It seems to me that it is only for allowing the use of perl *inside* of postgres and if one is just using perl programs to access the database from the outside this switch is not necessary. I want to make sure I give the applications...
0
1609
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 hold"). When I call this sp from java application (started under JRE 1.4) that uses jcc driver (suppose c - Connection object, cs - CallableStatement object) with c.setAutoCommit(true) and cs declared as
2
1506
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
1884
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 I first learned Python, the only reason why I just could not use it was inability to localize the lifetime of some variables inside some syntactical "blocks", especially ones in "for"/"while"/"if" statements, but possibly in any "manually...
4
5286
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 The above code was tested and works.
10
7360
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
1866
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 have a procedure that dynamically creates and drops a table. So, I am using a prepare statement to get all the values from one of the columns. I am then calling a procedure for each returned row. However, the procedure that I am calling has a commit....
1
2421
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 copies of the license. Great.) I've heard it said that the MIT license is one of the most permissive licenses, and that it allows a person to put MIT-licensed code into proprietary works (with the proper attribution). However, I don't understand...
0
1981
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 runtime. Now i want to define mapping between Product & ProductBasic, how will i do it ? Moreover suppose i define their mapping as product.productID = productBasic.productID and useCode='a' as :
0
9589
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
10222
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
10050
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...
1
9999
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7413
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
5310
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.