Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    49

    Unanswered: Functions in DB2

    Hi,

    I want to write a function that will conditionally return a table

    Something like

    IF 1=1 THEN
    select current timestamp,'Today' from sysibm.sysdummy1;
    else
    select current timestamp -1 DAYS,'Yesterday' from sysibm.sysdummy1;
    END if;


    This is just a symbolic of what I want to do....

    Any help is appreciated.

    Asha

  2. #2
    Join Date
    Dec 2002
    Location
    Little Rock, AR
    Posts
    17
    IF NOT PROCESSING-ERROR
    EXEC SQL
    SELECT CURRENT_TIMESTAMP
    INTO :WS-CURRENT-TIMESTAMP
    FROM SYSIBM.SYSDUMMY1
    END-EXEC
    ELSE
    EXEC SQL
    SELECT CURRENT_TIMESTAMP - 1 DAY
    INTO :WS-YESTERDAYS-TIMESTAMP
    FROM SYSIBM.DUMMY1
    END-EXEC
    END-IF.

    Hope this helps!
    Laura
    Laura Smith, DBA

Posting Permissions

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