日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > 互聯網 > Oracle動態SQL語句

Oracle動態SQL語句

來源:程序員人生   發布時間:2014-11-20 09:03:10 閱讀次數:3277次

動態SQL返回游標:

create or replace procedure proc_ValidityDueQuery( p_regioncode in number, p_pscode in number, p_outputcode in number, p_pollutantType in number, p_psclasscode in varchar2, p_attencode in varchar2, p_checkstatus in number, p_auditstatus in number, p_cursor out curdata ) as begin open p_cursor for 'select bs.regioncode, bs.regionname, bs.pscode, bs.psname, bs.outputcode, bs.outputname, bs.ptype, bd.chkname, bd.approvename, bd.pollutantname, case when ((bd.maxvalidtill - sysdate) > 0 and (bd.maxvalidtill - sysdate) <= 7) then ''yellow'' when (sysdate - bd.maxvalidtill) > 0 then ''red'' end color, case when bs.ptype = 1 then ''水'' when bs.ptype = 2 then ''氣'' end pstype, bd.auddate, to_char(bd.maxvalidtill, ''yyyy-MM-dd HH24:mi'') validtill from (select vb.regioncode, vb.regionname, vb.pscode, vb.psname, vo.outputcode, vo.outputname, vo.ptype from (select oregioncode regioncode, oregionname regionname, pscode, psname from v_baseinfo where 1 = 1 '|| case when p_regioncode >0 then 'and oregioncode='|| p_regioncode else '' end ||' '|| case when p_pscode>0 then 'and pscode='|| p_pscode else '' end ||' '|| case when p_psclasscode<>'0' then 'and psclasscodexc in ('|| p_psclasscode ||')' else '' end ||' '|| case when p_attencode<>'0' then 'and attentiondegreecode in ('|| p_attencode ||')' else '' end ||' ) vb, (select pscode, outputcode, outputname, inout, psstatus, ptstatus, ptype from v_output t where psstatus = 0 and ismonitor = 1 and ptstatus = 0 '|| case when p_pscode>0 then 'and pscode='|| p_pscode else '' end ||' '|| case when p_outputcode>0 then 'and outputcode='|| p_outputcode else '' end ||' '|| case when p_checkstatus=1 then 'and isgjkh=1 or isskkh=1' when p_checkstatus=0 then 'and isgjkh=0 or isskkh=0' else '' end || ' and ptype ='|| p_pollutantType ||' '|| case when p_psclasscode<>'0' then 'and psclasscodexc in ('|| p_psclasscode ||')' else '' end ||' '|| case when p_attencode<>'0' then 'and attentiondegreecode in ('|| p_attencode ||')' else '' end ||' ) vo where vb.pscode = vo.pscode) bs, (select pscode, outputcode, pollutantname, pollutantcode, auddate,maxvalidtill, approvename, chkname from v_scenecommonite where checkresult=''1'' '|| case when p_pscode>0 then 'and pscode='|| p_pscode else '' end ||' '|| case when p_outputcode>0 then 'and outputcode='|| p_outputcode else '' end ||' '|| case when p_auditstatus=1 then 'and ((maxvalidtill - sysdate) > 0 and (maxvalidtill - sysdate) <= 7)' when p_auditstatus=2 then 'and maxvalidtill >= sysdate⑼0' when p_auditstatus=3 then 'and sysdate>maxvalidtill' else '' end ||' ) bd Where bs.pscode=bd.pscode and bs.outputcode=bd.outputcode order by bd.maxvalidtill desc, bs.regioncode, bs.pscode, bs.outputcode'; end proc_ValidityDueQuery;

2.動態創建臨時表

--創建臨時表 --判斷是不是存在 select count(*) into v_num from user_tables where table_name=upper('zstemptable'); --如果不存在則創建 if v_num=0 then execute immediate 'create global temporary table zstemptable(id number(1),reviseddata number(20,6)) on commit preserve rows'; end if; --插入數據 execute immediate 'insert into zstemptable select 1,RevisedStrength from (select RevisedStrength from t_mod_gasfachourdata where pscode = '|| p_pscode ||' and outputcode = '|| p_outputcode ||' and pollutantCode = '''|| p_pollutantcode ||''' and monitorTime < to_date('''|| p_recordTime ||''',''yyyy-MM-dd HH24:mi:ss'') and availableStatus = 0 order by MonitorTime desc) where rownum = 1'; --查詢數據 execute immediate 'select count(*) from zstemptable where id=1' into v_hisstrength; --清除表信息 execute immediate 'truncate table zstemptable';

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 成人污视频在线观看 | 日韩一区二区三区视频 | 欧美国产中文字幕 | 久久精品视频一区 | 亚洲乱码国产乱码精品精98午夜 | 久久亚洲线观看视频 | 欧美日韩在线播放视频 | 国产精品久久久久久久免费大片 | 国产乱码一区二区三区 | 精品国产乱码久久久久久88av | 国产在线一二 | 亚洲欧洲成人av每日更新 | 国产精品视频一区二区三区, | 国产视频黄色 | 国产精品久久久久久久久久嫩草 | 亚洲精品高清视频 | 欧美日韩国产中文字幕 | 天堂成人av | 国产精品99久久久久久大便 | 日韩精品三区 | 国内精品久久久久久中文字幕 | 狠狠色狠狠色终合网 | 18av在线视频 | 久久精品看片 | 久久久亚洲一区 | 日本在线视频一区二区 | 国产一区二区精品 | 日韩一区二区三 | 黄色三级在线免费观看 | 秋霞毛片少妇激情免费 | 51精产品一区一区三区 | 成人97视频| 久久国产精品-国产精品 | 精品国产免费久久久久久尖叫 | 国产在线不卡视频 | 国产成人综合av | 伊人成人在线视频 | 国产精品久久久久精 | 亚洲国产精品成人女人久久 | 久久久二区 | 久久国产精品久久久久久 |