Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Posts
    2

    Unhappy Unanswered: Getting resultsets back from a DB2 sql atomic block

    undefinedHello
    I'm trying to find out a way in which messages like "hi" or "hello" can be returned to the command center/user.
    I also would like to know how to return any result sets from atomic block compound statement. Right now i can execute an atomic block like the following in Command Center.

    begin atomic
    insert into mytable values(10);
    select count(*) from mytable;
    end

    But I dont get back any resultset. All I get in the output area in the command center is

    begin atomic
    insert into mytable values(10);
    select count(*) from mytable;
    end


    DB20000I The SQL command completed successfully.
    ------------------------------------------------------------------------------------------------

    When I run the same select statement individually i get

    select count(*) from mytable

    1
    -----------
    109

    1 record(s) selected.
    --------------------------------------------------------------------------------------------------

    This is very urgent. Could somebody please help me out with this? Is there any way in which these resultsets can be passed back ..like dbms_output in oracle or soemthing like that. I've seen a UDF online which replicates dbms_output (PUT_LINE) but it is not suitable for the application I'm working on. Are they any other solutions to this problem of mine?
    Thank you very much
    Vijay

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Is there any particular reason why you need this "anonymous block"? Why not just run the two statements one after another?

  3. #3
    Join Date
    Oct 2004
    Posts
    2
    I want to have an anonymous block so that I could use logic inside it. When I have two statements one after the other, I cannot use if then - end if and loops and things like that, right? or am i wrong?

Posting Permissions

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