How do you select all columns, plus the result of a CASE statement in oracle 11g?

后端 未结 3 1631
迷失自我
迷失自我 2021-02-01 04:12

I want to select *, and not have to type out all individual columns, but I also want to include a custom column with a case statement. I tried the following:

se         


        
3条回答
  •  情深已故
    2021-02-01 04:20

    As IronGoofy says, add the table alias.

    On a different note be aware that there is a handy searched case syntax that would be suitable for your situation:

    select t.*,
           case PRI_VAL
             when 1 then 'High' 
             when 2 then 'Med' 
             when 3 then 'Low' 
           end as PRIORITY 
    from MYTABLE t; 
    

提交回复
热议问题