|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
remove the quotes from around the column name... for this purpose you really only need to use nvl.
|
|
#3
|
|||
|
|||
|
Decode thanks
Thanks for your help. The problem has been solved.
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Using Decode() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|