Prepare for your Next Interview
This is a discussion on Query within the Oracle forums, part of the Databases category; Hi everyone, I'm making a query to one table and I need to get different information from one numeric field but there is not data in all records... how ...
|
|||
|
Hi everyone, I'm making a query to one table and I need to get different information from one numeric field but there is not data in all records... how can I get a zero in the result??????
![]() |
| Sponsored Links |
|
|||
|
Re: Query
Decode function has the functionality of an IF-THEN-ELSE statement.
The syntax for the decode function is: decode( expression , search , result [, search , result]... [, default] ) expression is the value to compare. search is the value that is compared against expression. result is the value returned, if expression is equal to search. default is optional. If no matches are found, the decode will return default. If default is omitted, then the decode statement will return null (if no matches are found). For Example: You could use the decode function in an SQL statement as follows: SELECT supplier_name, decode(supplier_id, 10000, 'DELL', 10001, 'INFOSYS', 10002, 'WIPRO', 'Gateway') result FROM suppliers; |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Query with window XP | fred | Unix/Linux | 1 | 04-03-2007 11:28 PM |
| Dynamic Query | nancyphilips | Oracle | 2 | 10-13-2006 06:58 PM |
| Query with C++ | StephenRaj | C and C++ | 1 | 08-14-2006 05:09 AM |
| Query in ASP | timmy | ASP.NET | 1 | 07-26-2006 04:57 PM |
| Query with SQL Leading Zero | timmy | SQL | 2 | 07-17-2006 05:32 PM |