Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Type mismach in case switch

jerry44May 17 2015 — edited May 17 2015

I'm trying to check value of variable in case statement in following code:

declare

v_switch varchar2(9) ;

begin

case v_switch

  when v_switch = 'one' then dbms_output.put_line('one');

  when v_switch = 'two' then dbms_output.put_line('two');

  when v_switch = 'three' then dbms_output.put_line('three');

  else dbms_output.put_line('null');

  end case;

end;

but oracle returns:

Error report -

ORA-06550: line 5, column 6:

PLS-00615: type mismatch found at 'V_SWITCH' between CASE operand and WHEN operands

What caused this error?

This post has been answered by aJohny on May 17 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2015
Added on May 17 2015
2 comments
435 views