what is difference between decode and case function?
Answers were Sorted based on User's Feedback
Answer / neha sinha
1)Performance wise Case is good.
2)Case is easy to understand and debug.
3)Case is ANSI stranded and Decode is property of oracle.
4) We can use Decode only in SQL but we can use Case any
where like Function/procedure.
5)Decode can be use only for continuous data not for range
value. but case can be use for range value and it allowed
operator like ">" "between" also.
Is This Answer Correct ? | 17 Yes | 0 No |
Answer / shiva kumar
Case functions are of two types
1. SIMPLE CASE(Equivalent to DECODE)
2. SEARCHED CASE
1.SIMPLE CASE is equivalent to DECODE in performance.The
only difference is it is ANSI Standard where as DECODE
function is designed by oracle.
2.SEARCHED CASE is more powerful then DECODE.Using SEARCHED
CASE we can evaluate multiple conditions,range evaluation.
Is This Answer Correct ? | 3 Yes | 0 No |
what are local and global variables and their differences? : Sql dba
What is the difference between partitioning and sharding?
how to decrement dates by 1 in mysql? : Sql dba
What are the different operators available in sql?
What is referential integrity ?
Should I use mbr or gpt?
What are the topics in pl sql?
Write a query to get last 10 records from the table.
What are different categories of sql commands?
How many scalar data types are supported in pl/sql?
What is sql server and ase?
Is there a pl/sql pragma similar to deterministic, but for the scope of one single sql select?