View Single Post

   
  #2 (permalink)  
Old 05-10-2008, 02:03 PM
Tonkuma
 
Posts: n/a
Default Re: Not able to assign select query "WITH UR" CLUSE TO A VARIABLE

(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".
Reply With Quote