日期:2014-05-16 浏览次数:20857 次
CREATE OR REPLACE PROCEDURE P_CREATE_CUSTOMER AS
V_CUSTOMERID NUMBER(18);
V_CUSTOMERNO VARCHAR2(7);
ld_fr_date DATE := SYSDATE;
ld_end_date DATE;
ld_etr_date date := TO_DATE('1900-12-12', 'yyyy-mm-dd');
CURSOR CUR_CUST_ALL IS
SELECT S_CUSTOMER.NEXTVAL, TO_CHAR(CUST_ID)
FROM TB_AC001@LD;--where cust_id < 1010000
BEGIN
--请空图片表
--DELETE FROM CUR_PICTURE;
OPEN CUR_CUST_ALL;
LOOP
FETCH CUR_CUST_ALL
INTO V_CUSTOMERID, V_CUSTOMERNO;
--DBMS_OUTPUT.PUT_LINE(V_PIC_ID);
EXIT WHEN CUR_CUST_ALL %NOTFOUND;
--新增客户主表信息 TB_AC001@LD -->>CUSTOMER
INSERT INTO CUSTOMER
(CUSTOMERID, CUSTOMERNO, IS_MAIL, IS_DM, HAPPY_CALL, CUS_TYPE)
SELECT V_CUSTOMERID,
V_CUSTOMERNO,
DECODE(MAIL_SEND_YN, 'Y', '1', 'N', '0', '0'),
DECODE(DM_SEND_YN, 'Y', '1', 'N', '0', '0'),
DECODE(HAPPY_CALL_YN, 'Y', '1', 'N', '0', '0'),
1
FROM TB_AC001@LD
WHERE CUST_ID = V_CUSTOMERNO;
--在表CUS_PERSONAL表中插入数据
INSERT INTO CUS_PERSONAL
(CUSTOMERID,
BUSI_CODE,
CUS_CAT_ID,
NAME_CN,
GENDER,
REGION_ID,
CRED_TYP_ID,
CRED_NUM,
BIRTHDAY,
CUS_TRA_ID,
JOB_TYP_ID,
CUS_GRA_ID,
HAS_MARRIED,
SALARY_ID,
CUS_FROM_ID,
HAS_CHECKED,
STA_ID,
CRE_USE_ID,
CRE_DAT,
UPD_USE_ID,
UPD_DAT,