select decode(aa, 1, '有货', 9, '无货', null) from a;

解决方案 »

  1.   

    如果AA是字符型的则为:
    select decode(aa, '1', '有货', '9', '无货') AS "是否有货" from a;
      

  2.   

    这种代码的翻译最好写在视图里面,而不要写在开发的代码中。CREATE OR REPLACE VIEW V_A AS
    SELECT DECODE(AA,'1', '有货', '9', '无货') AS "是否有货" FROM A
    /这样,即便后期代码增加了一种,或者变动了翻译方式,那么可以直接修改视图,而不必改动代码
      

  3.   

    not null的话,可以
    select decode(aa,1, '有货', '无货') AS "是否有货" from a;