STEP 1:-create table
create table new_colum_chane(
currency_category_code varchar2(8) -- base, original
,ttl_amt number
,ttl_dis number
,ttl_tax number)
currency_category_code varchar2(8) -- base, original
,ttl_amt number
,ttl_dis number
,ttl_tax number)
STEP 2:- Insert values
insert into new_colum_chane values ('ORIGINAL',100,20,4.80);
select * from new_colum_chane
STEP 3:- NOW TRY THIS QUERY
select currency_category_code,
case
when new_arg_insert.rowno = 1 then 'TTL_AMT'
when new_arg_insert.rowno = 2 then 'TTL_DIS'
when new_arg_insert.rowno = 3 then 'TTL_TAX'
end dollar_name
,case
when new_arg_insert.rowno = 1 then ttl_amt
when new_arg_insert.rowno = 2 then ttl_dis
when new_arg_insert.rowno = 3 then ttl_tax
end amt
from new_colum_chane
,(
select rownum rowno
from dual
connect by level <=3
) new_arg_insert
order by 1,2
ANOTHER STEP :
select
max(sucess) sucess,
max( suc) suc
from
(
select
(case when ts='a' then va end) sucess,
(case when ts='b' then va end) suc
from
(
select
'a' ts,
'A' va
from dual
union all
select
'b' ts,
'B' va
from dual
))
-- Thank you Sumathi --
No comments:
Post a Comment