Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    18

    Unanswered: do db2 have unnamed procedure like oracle?

    do db2 have unnamed procedure like oracle?
    for example:
    in oracle,this code can be executed:
    declare
    ..
    begin
    ...
    end;
    but in db2,it seems it cannot be executed.
    do anyone have some advice?
    My task is to be responsible for converting oracle code to db2 code.
    can you help me in this question?
    thanks in advance

  2. #2
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    i dont get what you are looking about, if you dont want SP and want multiple SQL statements to process u can execute compound sql statements by :

    BEGIN ATOMIC
    DECLARE cntr SMALLINT DEFAULT 1;
    FOR V1 AS
    SELECT id as idval
    FROM staff
    WHERE id < 80
    ORDER BY id
    DO
    UPDATE staff
    SET comm = cntr
    WHERE id = idval;
    SET cntr = cntr + 1;
    END FOR;
    END

    --Rahul Singh

  3. #3
    Join Date
    Feb 2004
    Posts
    18
    Thanks very much for your help.
    you are kind...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •