Connecting Tech Pros Worldwide Help | Site Map

SQL0104 on Update with Fetch

  #1  
Old November 20th, 2008, 11:05 PM
shorti
Guest
 
Posts: n/a
I am on DB2 UDB V8.2

When I try to do a simple update with a "Fetch First" clause I get a
syntax error:

db2 "update exec_1 set lock = 100, level = 50 where level = 0 fetch
first 100 rows only"

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 "update EXEC_1 set (LOCK = 100, LEVEL =
" was
found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<values>". SQLSTATE=42601

I read an old post of someone else saying the same thing and the
response was that you had to be at DB2 V8. (the post was 5 years
old).


Can someone tell me why this wouldnt work?

Thanks!
  #2  
Old November 21st, 2008, 11:25 PM
Serge Rielau
Guest
 
Posts: n/a

re: SQL0104 on Update with Fetch


shorti wrote:
Quote:
db2 "update exec_1 set lock = 100, level = 50 where level = 0 fetch
first 100 rows only"
UPDATE (SELECT lock, level FROM exec_1 WHERE level = 0 FETCH FIRST 100
ROWS ONLY) AS U SET lock = 100, level = 50;

(I'm not going to discuss the wisdom of this statement)


Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Closed Thread