我有一堆SQL查询(更新语句,存储过程,插入语句,选择语句)。我的期望是需要在Oracle中运行和执行这些查询的日志文件。如果我们使用update语句,则可以使用预处理语句,但我使用的是存储过程。我已经用Java代码封装了需要在oracle db中运行的文本文件。
SPOOL IMS_SO_PostConv_788.LOG
set serveroutput on size 1000000;
select systimestamp from dual;
---------------------------------------------------------------------------------
-------- Post Conversion Script For Salesforce TO SO Conversion ---------------
---------------------------------------------------------------------------------
CALL APK(788);
COMMIT;
------------------------------------------------------
--- DELETE DUPLICATE ADDRESS/PHONE/WEBADDRESS RECORD
------------------------------------------------------
DELETE FROM CDSWEB.ADDRESS WHERE OFFICEID = 788 AND (LINE1 IS NULL AND LINE2 IS NULL AND LINE3 IS NULL AND LINE4 IS NULL AND LINE5 IS NULL )AND CITY IS NULL AND STATE IS NULL AND COUNTRY IS NULL AND POSTALCODE IS NULL;
COMMIT;
DELETE FROM CDSWEB.ADDRESS WHERE OFFICEID = 788 AND ADDRESSID IN(SELECT I1.ADDRESSID FROM ADDRESS I1, ADDRESS I2 WHERE I1.OFFICEID = 788 AND I2.OFFICEID = 788 AND I1.CONTACTID = I2.CONTACTID AND I1.CONTACTOFFICEID = I2.CONTACTOFFICEID AND I1.ADDRESSTYPE = I2.ADDRESSTYPE AND I1.LINE1 = I2.LINE1 AND I1.CITY = I2.CITY AND I1.STATE = I2.STATE AND I1.COUNTRY = I2.COUNTRY AND I1.POSTALCODE = I2.POSTALCODE AND I1.ADDRESSID > I2.ADDRESSID);
COMMIT;
UPDATE CDSWEB.CONTACT SET DEFRESADDRID = NULL WHERE OFFICEID = 788 AND RECORDTYPE = 2;
COMMIT;
--- Business record cannot have preferred address of type residence
UPDATE CDSWEB.CONTACT SET PREFERREDADDRID = NULL WHERE OFFICEID = 788 AND RECORDTYPE = 2 AND PREFERREDADDRID IN (SELECT ADDRESSID FROM ADDRESS WHERE OFFICEID = 788 AND ADDRESSTYPE = 1);
COMMIT;
--- Primary residence address setting for non-business
UPDATE CDSWEB.CONTACT C SET C.DEFRESADDRID = (SELECT MIN(A.ADDRESSID) FROM CDSWEB.ADDRESS A WHERE A.OFFICEID = 788 AND A.CONTACTOFFICEID = C.OFFICEID AND A.CONTACTID = C.CONTACTID AND A.ADDRESSTYPE = 1) WHERE C.OFFICEID = 788 AND C.DEFRESADDRID IS NULL AND C.RECORDTYPE <> 2;
COMMIT;
--------------------------------------------------------
--- Activity_Contact Table
--- For missing Activity_Contact records inserting
--------------------------------------------------------
CREATE OR REPLACE PROCEDURE `CDSWEB`.`ebixDMG_VENDORSTATUS`(V_OID IN OFFICE.OFFICEID%TYPE)
IS
V_VENDORID NUMBER;
V_VENDORSTATUSID NUMBER;
CURSOR VENDOR_CUR IS SELECT CONTACTID FROM CDSWEB.VENDOR WHERE OFFICEID = V_OID;
BEGIN
OPEN VENDOR_CUR;
LOOP
FETCH VENDOR_CUR INTO V_VENDORID;
EXIT WHEN VENDOR_CUR%NOTFOUND;
CDSWEB.GETPKVALUE(V_OID, 4039, V_VENDORSTATUSID);
INSERT INTO CDSWEB.VENDORSTATUS(OFFICEID, VENDORSTATUSID, VENDOROFFID, VENDORID, STATUS) VALUES(V_OID, V_VENDORSTATUSID, V_OID, V_VENDORID, 0);
COMMIT;
END LOOP;
END;
/
CALL CDSWEB.ebixDMG_VENDORSTATUS(788);
COMMIT;
DROP PROCEDURE CDSWEB.ebixDMG_VENDORSTATUS;
COMMIT;
------------------------------
--- Appuser insertion ------
------------------------------
INSERT INTO CDSWEB.APPUSER (APPUSERID, OFFICEID, CREATEDON,LOGINNAME, FULLNAME, USERSTATUS, SUPERUSER) SELECT APPUSERID, 788, SYSDATE,LOGINNAME, FULLNAME, USERSTATUS, SUPERUSER FROM APPUSER WHERE OFFICEID = 1 AND APPUSERID = 1;
COMMIT;
UPDATE `CDSWEB`.`INTERESTPARTY` SET `CONTACTOFFICEID`=788 WHERE OFFICEID=788;
COMMIT;
CALL APK(788);
COMMIT;
set `serveroutput` on size 1000000;
select `systimestamp` from dual;
SPOOL OFF;
需要一个用于文本文件查询的日志文件。