Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to display the return this way?
Use the decode function:
SQL> select * from ref_plan_types;
PLAN_TYPE_ID DESCRIPTION
------------ -------------------------------------------------- 1 PLAN 2 LISTING
SQL> select plan_type_id, description, decode(plan_type_id, 1, 42, 2, 0, 19) from ref_plan_types order by 3;
PLAN_TYPE_ID DESCRIPTION
------------ --------------------------------------------------DECODE(PLAN_TYPE_ID,1,42,2,0,19)
2 LISTING 0 1 PLAN 42
C Chang wrote:
> I have a select script such as:
>
> Select A, B
> from myTable
> where A = 'A1'
> or A = 'D1'
> or A = 'C1'
> or A = 'B1';
>
> How do I let my return display as my order in where clause:
>
> A1 Bxx
> D1 BXXX
> C1 BX
> B1 Byy
>
> but not in sorted order of column A -> A1, B1, C1, D1.
>
> C Chang
Received on Fri Dec 14 2001 - 11:11:58 CST
![]() |
![]() |