CREATE OR REPLACEPackage BODY SSL as PROCEDUREInsert_ssl (SinchSsl_array) asV_monthvarchar2( -); V_sqlvarchar2( the); V_result Number; V_status Number; BEGIN Delete fromE_tmp_mp_ssl_curve; SelectTo_char (S (s.first). Data_time,'yyyymm') intoV_month fromdual; V_result:=-Ten; forIinchs.first. S.last LOOPBEGIN INSERT intoE_tmp_mp_ssl_curve (Mped_id,data_time,ps_flag,p,pa,pb,pc,q,qa,qb,qc,ua,ub,uc,ia,ib,ic,COS, Cosa,cosb,cosc,paia,paib,paic,paua,paub,pauc,savedatetime,p_coef,q_coef,v_coef,c_coef,area_code,factor_ COEF)VALUES(S (i). mped_id, S (i). Data_time, S (i). Ps_flag, S (i). P, S (i). Pa,s (i). Pb,s (i). PC, S (i). Q, S (i). Qa,s (i). Qb,s (i). QC, S (i). Ua,s (i). Ub,s (i). Uc,s (i). Ia,s (i). Ib,s (i). IC, S (i) .Cos, S (i). Cosa,s (i). Cosb,s (i). Cosc,s (i). Paia,s ( i). Paib,s (i). Paic,s (i). Paua,s (i). Paub,s (i). Pauc, Sysdate,1,1,1,1, S (i). Area_code,s (i). FACTOR_COEF); END; ENDLOOP; V_result:=- -; V_sql:= 'Delete from E_mp_ssl_curve_'||V_month||'A where exists (select 1 from e_tmp_mp_ssl_curve b where a.mped_id = b.mped_id and A.data_time = B.data_time and A.P S_flag = B.ps_flag)'; Executeimmediate v_sql; V_result:=- -; V_sql:= 'INSERT INTO E_mp_ssl_curve_'||V_month||'(mped_id, Data_time, Ps_flag, UA, UB, UC, IA, IB, IC, I0, p, PA, Pb, PC, Q, QA, QB, QC, cos, Cosa, COSB, Cosc, SP, SP A, SPB, SPC, FN, Paia, Paib, Paic, Paua, Paub, Pauc, Temple, AVGP, Avgq, P_coef, Q_coef, V_coef, C_coef, Factor_coef, save datetime, Area_code) SELECT * FROM E_tmp_mp_ssl_curve'; Executeimmediate v_sql;Commit; EXCEPTION whenOTHERS Then begin ROLLBACK; V_status:=Error_log (V_result, SQLCODE, SQLERRM,'Insert_ssl'); End; ENDInsert_ssl;ENDSsl
PL/SQL Stored procedures-China power load data storage function-for reference only