Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > using decode/if statemtn in select?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-04, 12:16
etravels etravels is offline
Registered User
 
Join Date: Feb 2004
Posts: 93
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
Reply With Quote
  #2 (permalink)  
Old 10-01-04, 12:27
ss659 ss659 is offline
Registered User
 
Join Date: Jan 2004
Posts: 492
select
decode(status_updated, 2, status_updated, null)
from table
__________________
Oracle OCPI (Certified Practicing Idiot)
Reply With Quote
  #3 (permalink)  
Old 10-01-04, 12:28
ss659 ss659 is offline
Registered User
 
Join Date: Jan 2004
Posts: 492

Ignore the first post - didnt read it correctly


select
decode(status_type, 2, status_updated, null)
from table
__________________
Oracle OCPI (Certified Practicing Idiot)

Last edited by ss659 : 10-01-04 at 12:32.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On