--001
select
TO_CHAR(V8_REP_XCTH_SUMUP.GROSS_REV,'999G999G990D00') GROSS_REV,
TO_CHAR(V8_REP_XCTH_SUMUP.gross_room_rev,'999G999G990D00') GROSS_ROOM_REV,
TO_CHAR(V8_REP_XCTH_SUMUP.xcth_grossrev,'999G999G990D00') xcth_grossrev,
TO_CHAR(V8_REP_XCTH_SUMUP.xcth_grossroomrev,'999G999G990D00') xcth_grossroomrev,
TO_CHAR(V8_REP_XCTH_SUMUP.xcth_ccmgrossrev,'999G999G990D00') xcth_ccmgrossrev,
XCTH_CONTRACTNAME Contract_Number,
(select count(1) from xcth sub where SUB.XCTH_MASTER_XCTH_ID = V8_REP_XCTH_SUMUP.XCTH_ID) subContractCount,
V8_REP_XCTH_SUMUP.* from 
V8_REP_XCTH_SUMUP
where 
V8_REP_XCTH_SUMUP.XCTH_ID =:Parameter;

--002
select a.*,
decode(mod(rownum,2), 0, 'WhiteLineCRM', 'GreyLineCRM') cssclass
 from 
(
select 
      Decode(xcms.xcms_type,
         1,xcms.xcms_name1||' '||xcms.xcms_name2||' '||xcms.xcms_name3
	      ,trim(
	       decode(nvl(xcms.xcms_name1,''),'','',xcms.xcms_name1||decode(nvl(xcms.xcms_name3,''),'','',',')||' ')||
  	       decode(nvl(xcms.xcms_name3,''),'','',xcms.xcms_name3||' ')||
	       xcms.xcms_name2
		   )) as Name
from   xctl 
inner join xcms on xctl_xcms_id = xcms_id 
where xctl_xcth_id = :Parameter
order by xctl_xcth_id desc) a;

--003
select zcur.zcur_shortdesc CURRENCY from zcur,wuss
where upper(wuss.WUSS_NAME)='BASECURRENCY' and
	  wuss.WUSS_VALUE=zcur.ZCUR_ID;

--004
select xcth_id,xcth_name, XCTH_CONTRACTNAME xmnr_value
  ,xcms_Name1||' '|| xcms_name2||' '|| xcms_name3 as xcmsName
from xcth,xcms
where XCTH_MASTER_XCTH_ID=:parameter
and xctl_xcth_id = xcth_id
and xcms_id=xctl_xcms_id;           
