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

    Unanswered: using decode/if statemtn in select?

    Hi all

    Can someone tell me how to use the decode in the following;

    I want to set up decode statement in a select query for the following

    Select contact.contact_reference||','||
    contact.original_owner_id||','||
    contact_x.d1
    decode(contact.status.type,2,' ')-1)||','||

    I want to to return values for --contact.status_updated only when contact.status_type=2 otherwise leave blank...



    contact.contact_method_id||','||
    contact.created ||','||
    contact.status_type||','||
    contact.original_group_id||','||
    contact.current_owner_id||','||
    contact.created_by
    from contact


    would I use decode

    cheers
    E
    Cheers
    Etravels

  2. #2
    Join Date
    Jan 2004
    Posts
    492
    select
    decode(status_updated, 2, status_updated, null)
    from table
    Oracle OCPI (Certified Practicing Idiot)

  3. #3
    Join Date
    Jan 2004
    Posts
    492

    Ignore the first post - didnt read it correctly


    select
    decode(status_type, 2, status_updated, null)
    from table
    Last edited by ss659; 10-01-04 at 12:32.
    Oracle OCPI (Certified Practicing Idiot)

Posting Permissions

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