Difference between Decode and Case?
Answers were Sorted based on User's Feedback
Answer / judith
Decode
The default operator for comparison is '=',
for e.g select deptno,decode
(deptno,10,'dept10',20,dept20,default)
so if the deptno=10 then the value is replaced by dept10
and so on,
whereas in Case:
we can use any operator other than '=',
for e.g
select deptno,
case when deptno=10 and sal>1000 then 'dept10'
else
'dept20'
Hope the difference is made clear.
Regards,
Judith
| Is This Answer Correct ? | 33 Yes | 8 No |
Answer / vasu
Decode: using for reporting purpose. and it is implemented
by if stmt.
Ex: select decode(job,'CLERK','executive',job) from emp;
Case : implemented by if & elsif condition. it is using
pl/sql equality conditionality.
Ex : select case job='CLERK' then 'executive' else 'no' end
a from emp;
it is also used for multipul colms & multi conditions.
in above stmt a is reffered alias name.
| Is This Answer Correct ? | 24 Yes | 16 No |
Answer / suman vyas
1) Case Can work with logical operator other than '=' . such as < , > , = < , >=
where Decode performs an equality check only.
2) Decode can work as function inside SQL only,
where Case can work in Pl/Sql as a substitute of IF-THEN-ELSE.
3) Decode can not process Null , where Case can process Null.
4) Case expects datatype Consistency, Decode Dose not.
5) Decode is a function, where Case is a statement.
hope this will give u satisfied Answer for Difference Between CASE AND DECODE.
Thanks
Suman Vyas
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / satishe
Decode and Case functionwill work in the same way.the only
difference is we can write conditions in side the case
function.
for Ex;
case(if c>d,d...)
decode(job,'clerk'...)
| Is This Answer Correct ? | 15 Yes | 14 No |
Answer / gurujothi
*CASE can only be used inside the SQL statement where as CASE can be used anywhere even as a parameter of a function or procedure.
*Decode can do equality check only but Case can do more logic comparisons such as <,>etc.,
*The Case will handle NULL differently
| Is This Answer Correct ? | 4 Yes | 3 No |
Answer / zeya.ocp
CASE Expr make u use IF-THEN-ELSE logic in sql statements without to invoke procedure.It complies with ANSI SQL.
DECODE function decode an expr in a way similar to IF-THEN-ELSE logic that is used in various languages.it facilitate conditional inquiries.
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / neeraj
Can anyone explain me Null value handle by Case & Decode with Example.
| Is This Answer Correct ? | 0 Yes | 0 No |
1.what is the use of migration.(converting one version to another) 2. what r the migration issues faced while migrating from Bo5.x to BOXIR2 n how 2 resolve it. 3. provide some .ppt/material to understand abt migration easily.
what r the main topics to prepare for the crystal reports? could any on help me? i want to preparing for the interviews? and also send any pdf file?
Hi I am starter in BOXIR2.CAn anyone plz tell me the user identification details to be entered at the time of login to designer/deski
How to execute the plsql procedure from the report by clicking with mouse?
what are slowly changing dimensions, confirm dimensions?
how to add duplicte rows to the existing report in webi ?
How can we use multiple data providers in a single report in business objects?
Hi, Webi report is created using universeA and this report needs to be shifted to UniverseB.So when i am trying to change report to new universeB from edit query properties, the report just hangs at the point of changing source to target.The reports which hangs mainly are the crosstab reports that has large data and many formulas. Any help on this is much appreciated. Thanks
I have a report with two queries and each query have prompt on some object. Tell me how many times it will ask for the input?
Can any body Explain me what are the critical problems you have faced in the designer and repoting level in the real time environment?
Can We customize the Business Object infoview in BO?
Suppose we had a scenerio like in an universe there are nearly 250 objects but only 50 objects data is updated frequently so is there any way to overcome it.(Birla Soft,)