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

    Unanswered: change to db2 code

    How to change these oracle code to db2 code:
    declare cnt int;
    begin
    SELECT COUNT(*) INTO cnt from PODTX03
    WHERE TRNDATE < INT( TOCHAR( sdate, 'YYYYMMDD' ) ) ;
    end;

    thanks

  2. #2
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    96
    Quote Originally Posted by welyngj
    How to change these oracle code to db2 code:
    declare cnt int;
    begin
    SELECT COUNT(*) INTO cnt from PODTX03
    WHERE TRNDATE < INT( TOCHAR( sdate, 'YYYYMMDD' ) ) ;
    end;

    thanks
    Check this website for a lot of valuable UDF's when migrating to DB2. Because they were created when V9 didn't exist some of them might be available allready as a builtin function.

    Regards, Gert

  3. #3
    Join Date
    Feb 2004
    Posts
    18
    Thanks for your reply.
    Except the user defined function,
    I also want to know how to
    change the 'select count(*) into cnt from tb1 '
    into db2.
    It cannot execute like 'begin atomic declare cnt int;
    select count(*) into cnt from tb1; end'.

  4. #4
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    create table count (no integer)@

    begin atomic
    declare cnt int;
    delete from count;
    set cnt=(select count(*) from eone.tdb_patch_dtl);
    insert into count values (cnt);
    end@

    --Rahul Singh

  5. #5
    Join Date
    Feb 2004
    Posts
    18
    Thanks.solved

Posting Permissions

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