Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    2

    Question Unanswered: iif equivalent in oracle

    hi
    i want to convert the following access query fn format

    iif(date1>=date2,val1,val2) to oracle

    i tried using case when as follows

    select v from tab
    where d = (case date1>=date2
    when true then stmt
    else stmt
    end )

    actually i got messed up with this case stmts
    plz help me

    thanks

  2. #2
    Join Date
    Sep 2003
    Posts
    27

    Re: iif equivalent in oracle

    Try something like this:


    SQL> select * from test1;

    COL1 COL2
    ----------- -----------
    01-JAN-2000 01-MAR-2003
    31-DEC-2010 01-MAR-2003

    SQL> select
    CASE WHEN col1 >= col2 THEN 'Val1' ELSE 'Val2' END as "VAL"
    from test1;

    VAL
    ----
    Val2
    Val1

    Tim.

Posting Permissions

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