Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old February 7th, 2005, 07:25 AM
jdc44 jdc44 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 jdc44 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 23 sec
Reputation Power: 0
Send a message via AIM to jdc44
Using Decode()

Hi all,
I am using the decode() function inside a sql query and am having a problem with with with it. I'm using php in a web script - not sqlplus.

I want to determine if the 'ev_name' field has a value in it. If it does, I want that value returned. If not, I want "no entry" returned.

I.e., "SELECT EV_NAME, DECODE('EV_ADDR1',NULL,'NO ENTRY',EV_ADDR1) ADDR1 FROM VENDORS";

Some records have an ev_addr1 entry and some do not. My problem is I'm getting "NO ENTRY" returned on every record. Why?

I've also tried ... DECODE('EV_ADDR1,'','NO ENTRY',EV_ADDR1) ADDR.... and DECODE('EV_ADDR1,' ','NO ENTRY',EV_ADDR1) ADDR.

Any tips or suggestions would be appreciated.
Thanks,
jdc44

Reply With Quote
  #2  
Old February 7th, 2005, 08:51 AM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 692 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 21 h 49 m 55 sec
Reputation Power: 19
remove the quotes from around the column name... for this purpose you really only need to use nvl.

Reply With Quote
  #3  
Old February 7th, 2005, 09:53 AM
jdc44 jdc44 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 jdc44 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 23 sec
Reputation Power: 0
Send a message via AIM to jdc44
Decode thanks

Thanks for your help. The problem has been solved.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Using Decode()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway