日期:2014-05-17  浏览次数:21873 次

ORA-00932: inconsistent datatypes: expected
data_sql Varchar2(20000);
data_sql1 Varchar2(20000);
data_sql2 VARCHAR2(20000);
data_sql1:='SELECT TO_CHAR (r.create_time,''yyyy-MM-dd'') reporttime, r.callmen_name,r.callman_tel,r.reflected_people, r.content, r.handel_result,d.draught_name happenarea,';
data_sql1:=data_sql1 ||' DECODE (r.problem_type, ''0'', ''咨询'', ''1'', ''举报'', ''咨询'') ctype,DECODE (r.REPORT_METHOD_ID, ''rw1'', ''来电'', ''rw2'', ''来访'', ''rw3'',''来信'',''rw4'',''EMAIL'',''rw5'',''12345'',''rw6'',''政风行风'',''rw7'',''国家发改委'',''rw8'',''领导信箱'',''rw9'',''其它委办'',''来电'') ways,q.levelname,r.odd_num, r.work_no, '''' beizhu,';
data_sql1:=data_sql1 ||' DECODE (q.id,''3'',''粮食'',''9'',''成品油'',''8'',''电力'',''7'',''电力'',''6'',''电力'',''cy71'',''电力'',''4'',''化肥等农资'',''11'',''水价'',''12'',''水价'',''13'',''水价'',''cy72'',''水价'',''102'',''其它商品零售'',''60'',''商场超市'',''53'',''电子商业'',''cy66'',''其它商品零售'',''49'',''供热'',''50'',''供热'',''cy73'',''供热'',';
data_sql1:=data_sql1 ||' ''47'',''燃气'',''48'',''燃气'',''cy74'',''燃气'',''52'',''其他商品'',''cy65'',''其他商品'',''cy67'',''其他商品'',''66'',''教育'',''68'',''教育'',''65'',''教育'',''67'',''教育'',''cy75'',''教育'',''cy60'',''医药'',''cy59'',''医药'',''cy76'',''医药'',''71'',''其它交通运输'',''72'',''其它交通运输'',''73'',''其它交通运输'',''74'',''其它交通运输'',''75'',''其它交通运输'',''cy62'',''其它交通运输'',';
data_sql1:=data_sql1 ||' ''77'',''其它交通运输'',''cy61'',''其它交通运输'',''cy64'',''拖车'',''cy69'',''其它交通运输'',''78'',''机动车停车场'',''79'',''非机动车停车场'',''cy68'',''其它交通运输'',''80'',''旅游'',''81'',''旅游'',''cy78'',''旅游'',''82'',''房地产'',''83'',''房地产'',''84'',''房地产'',''cy79'',''房地产'',''85'',''物业管理'',''86'',''物业管理'',''cy80'',''物业管理'',''87'',''邮政通信'',''88'',''邮政通信'',''89'',''邮政通信'',''cy81'',''邮政通信'',';
data_sql1:=data_sql1 ||' ''27'',''维修费'',''28'',''餐饮业'',''29'',''其他服务'',''30'',''其他服务'',''31'',''其他服务'',''90'',''其他服务'',''91'',''其他服务'',''92'',''其他服务'',''32'',''其他服务'',''40'',''其他'',''37'',''国土'',''38'',''环保'',''39'',''机关收费'',''36'',''质监'',''35'',''工商'',''34'',''公安'',''其他服务'') trade';
data_sql1:=data_sql1 ||' from REPORT_APPROVE t left join EMPLOYEE e on e.id=t.group_leaderid left join REPORT_FORM r left join QUESTIONCLASSIFY q on q.id=r.problem_id on r.id=t.report_formid left join draught d on d.id=r.happen_areaid  where t.flowid in (''9'',''8'',''a4'') and t.emergencyid is null';
if problemid is not null and problemid <> 'null' 
then
data_sql1:=data_sql1 ||' and r.problem_id IN (SELECT ID FROM questionclassify  START WITH ID ='''||problemid||''' CONNECT BY parentid = PRIOR ID)  ';
end if;
if tovoid is not null and tovoid <> 'null' 
then
if tovoid <> '0' 
then
data_sql1:=data_sql1 ||' AND (r.to_void <> ''0'') ';
else 
data_sql1:=data_sql1 ||' AND r.to_void =''0''';
end if;
end if;
if ways is not null and ways <>'null'
then
if ways ='rw1'
then
data_sql1:=data_sql1||' and (r.REPORT_METHOD_ID is null or r.REPORT_METHOD_ID='''||ways||''') ';   
else