2015年2月3日 存储过程处理参数没有传递的解决方法

 
where decode(P_QColumn,'是',1,2)=2 
         and (C.CANTON=P_DW or P_DW is null) 
         and (D.ORG_NAME=P_ZYQ or P_ZYQ is null)
         and (C.ORG_NAME=P_CYD or P_CYD is null)
         and (F.PROJECT_NAME=P_QK or P_QK is null)
         and (G.COMPLETION_NAME=P_CW or P_CW is null)
         and (A.WELL_COMMON_NAME=P_JH or P_JH is null)
         and (decode(substr(A.WELL_PURPOSE,0,4),'1101','油井','1102','气井','1201','水井',A.WELL_PURPOSE)=P_JLX or P_JLX is null) 
         and ((B.PROD_DATE in (select to_date(S_Value,'yyyy-MM-dd') as RQ from table(split(P_TCRQ, ',')))) or P_TCRQ is null);

 

    INSERT INTO GLOBAL_TEMP_DYRB_XY
 97         SELECT T1.PROD_DATE,
 98                T4.CANTON,
 99                T4.WELL_COMMON_NAME,
100                T4.GROUP_UNIT_NAME,
101                (CASE
102                  WHEN T4.OIL_PRODUCTION_METHOD = '11' THEN
103                   '自喷采出'
104                  WHEN T4.OIL_PRODUCTION_METHOD = '101' THEN
105                   '油管生产'
106                  WHEN T4.OIL_PRODUCTION_METHOD = '102' THEN
107                   '套管生产'
108                  WHEN T4.OIL_PRODUCTION_METHOD = '103' THEN
109                   '油套合采'
110                  WHEN T4.OIL_PRODUCTION_METHOD = '2' THEN
111                   '机械采出'
112                END) OIL_PRODUCTION_METHOD,
113                T1.PROD_TIME,
114                T3.PUMP_DIAMETER,
115                T3.PUMP_STATUS,
116                T3.PUMP_DEPTH,
117                T3.PUMP_EFFICIENCY,
118                T2.OIL_NOZZLE,
119                T3.STROKE_LENGTH,
120                T3.STROKE_FREQUENCY,
121                T2.MAX_TUBING_PRES,
122                T2.MIN_TUBING_PRES,
123                T2.MAX_CASING_PRES,
124                T2.MIN_CASING_PRES,
125                T2.BACK_PRES,
126                T3.FLOW_PRES,
127                T3.STATIC_PRESSURE,
128                T1.LIQ_PROD_DAILY,
129                T1.OIL_PROD_DAILY,
130                T1.GAS_PROD_DAILY,
131                T2.WATER_CUT_WATER_MIX,
132                T1.WATER_CUT,
133                T1.SAND_CONTENT_RATIO,
134                T3.DYNAMIC_LIQ_LEVEL,
135                T3.STATIC_LIQ_LEV,
136                T1.CREATE_USER_ID,
137                T1.CREATE_DATE,
138                T1.REMARKS,
139                T4.COMPLETION_ID
140           FROM PC_PRO_COMPLETION_VOL_DAILY    T1,
141                PC_PRO_COMPLETION_STATUS_DAILY T2,
142                TEMP_WELL_MECH_ALL             T3,
143                GLOBAL_TEMP_DYRB_JC                            T4
144          WHERE decode(P_QColumn,'',1,2)=2 and  (T1.WELL_ID = T2.WELL_ID(+)
145            AND T1.COMPLETION_ID = T2.COMPLETION_ID(+)
146            AND T1.PROD_DATE = T2.PROD_DATE(+)
147            AND T1.WELL_ID = T3.WELL_ID(+)
148            AND T1.PROD_DATE = T3.PROD_DATE(+)
149            AND T1.COMPLETION_ID = T4.COMPLETION_ID
150            AND T1.WELL_ID = T4.WELL_ID ) 
151            AND (T4.WELL_COMMON_NAME = P_JH or  P_JH is null)
152            AND 
153         /*   T1.PROD_DATE BETWEEN (P_KSRQ) AND P_JSRQ
154         2015年2月2日 22:28:58郭修改
155         */
156       ( (T1.PROD_DATE>=P_KSRQ or  P_KSRQ is null) and (T1.PROD_DATE<=P_JSRQ or  P_JSRQ is null)) ;--时间范围;
157            

 

posted @ 2015-02-03 10:53  博客园董事长  阅读(154)  评论(0编辑  收藏  举报