如何解决解码错误?

时间:2013-03-22 19:35:54

标签: oracle plsql oracle10g oracle11g oracle9i

我跟随声明需要正确,当v_variable ='KP'时,将进入错误状态。任何人都可以帮忙!

select *
  FROM pat_register_org_det prod
 where prod.org_code in
       decode(v_variable, 'K', '3', 'KP', '3, 6', 'PAK', '6');

1 个答案:

答案 0 :(得分:3)

select *
FROM pat_register_org_det prod
where (v_variable, prod.org_code) in 
  (('K', '3'), ('KP', '3'), ('KP', '6'), ('PAK', '6'));