Performance decission DECODE vs CASE
647681Jul 14 2008 — edited Aug 16 2010Hi Gurus,
I have a stored procedure that has to process around 2 million records. The performance is very slow at the moment.
I need advise on the following section :-)
CASE x
WHEN '1' THEN
y := 'A';
WHEN '2' THEN
y := 'B';
WHEN '3' THEN
y := 'C';
.
.
.
.
WHEN '...'
y := '...';
END CASE;
There are around 25 different cases, of course the values I put here are dummy...
Can I replace it with DECODE as its 1 to 1 comparison / return like
y := DECODE(x, '1', 'A', '2', 'B', '3', 'C', .... '...', '...');
Is it a faster executing code or CASE better? I know, CASE has its own advantages like readability, flexibility etc. but how about performance in my particular expression set?
Best Regards,
Faisal.