调用db2存储过程的时候报错报错 100
存储过程如下--创建存储过程,每天同步S层表的数据到O层的当天日期的分区中。CREATEORREPLACEPROCEDURECRMSUINING.SP_O_C03_P_G...
存储过程如下
--创建存储过程,每天同步S层表的数据到O层的当天日期的分区中。
CREATE OR REPLACE PROCEDURE CRMSUINING.SP_O_C03_P_GROUP_ALL()
LANGUAGE SQL
BEGIN
declare v_date DATE;
declare v_sql01 varchar(1000);
--赋值v_date函数F_DATE_PRE()返回值
SELECT CRMSUINING.F_DATE_PRE() INTO v_date FROM SYSIBM.SYSDUMMY1;
--设定这个表的操作不记录日志,避免报错:日志已满
SET v_sql01='ALTER TABLE CRMSUINING.O_C03_P_GROUP_ALL ACTIVATE NOT LOGGED INITIALLY';
EXECUTE IMMEDIATE v_sql01;
SET v_sql01='
INSERT INTO CRMSUINING.O_C03_P_GROUP_ALL(CUST_ID,CUST_NAME,IDEN_TYPE_CD,IDEN_NO,GENDER_CD,BIRTH_DT,CORP_TELEPHONE_NO,HOME_PHONE,EMAIL_ADDR,HOME_ADDR
,HOME_POST_CODE,MOBILE_TELEPHONE,CORP_ADDR,MARRIAGE_STATUS_CD,CORP_NAME,NATION_CD,CUST_LEV,SEASON_AVG,LOAN_BAL)
SELECT
TRIM(DI.EC_CUST_NO)
,TRIM(DI.EC_FULL_NAM)
,TRIM(PGA.IDEN_TYPE_CD)
,TRIM(DI.EC_CER_NO)
,TRIM(PGA.GENDER_CD)
,TRIM(PGA.BIRTH_DT)
,TRIM(PGA.CORP_TELEPHONE_NO)
,TRIM(PGA.HOME_PHONE)
,TRIM(PGA.EMAIL_ADDR)
,TRIM(PGA.HOME_ADDR)
,TRIM(PGA.HOME_POST_CODE)
,TRIM(ADR.CI_MOBILE_PHONE)
,TRIM(PGA.CORP_ADDR)
,TRIM(PGA.MARRIAGE_STATUS_CD)
,TRIM(PGA.CORP_NAME)
,TRIM(PGA.NATION_CD)
,TRIM(PGA.CUST_LEV)
,TRIM(PGA.SEASON_AVG)
,TRIM(PGA.LOAN_BAL)
FROM CRMSUINING.S_T01_CBOD_ECCIFIDI DI
LEFT JOIN CRMSUINING.S_T01_CBOD_CICIFADR ADR ON ADR.FK_CICIF_KEY = DI.EC_CUST_NO AND ADR.CI_ADDR_COD=''MOB''
LEFT JOIN CRMSUINING.S_C03_P_GROUP_ALL PGA ON PGA.CUST_ID=DI.EC_CUST_NO AND PGA.STATIS_DT=''2017-08-31''';
EXECUTE IMMEDIATE v_sql01;
END
@
CALL CRMSUINING.SP_O_C03_P_GROUP_ALL()
@
调用存储过程时,会报错
CALL CRMSUINING.SP_O_C03_P_GROUP_ALL()
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=END-OF-STATEMENT;INING.S_C03_P_GROUP_;JOIN <joined_table>, DRIVER=4.18.60
Script: 脚本24.sql
Database Name: crm
Authorization Id (Database): db2inst1
System/IP Address : LAPTOP-9OMRLOIB/32.107.136.84
User Id (System) : ronaldo 展开
--创建存储过程,每天同步S层表的数据到O层的当天日期的分区中。
CREATE OR REPLACE PROCEDURE CRMSUINING.SP_O_C03_P_GROUP_ALL()
LANGUAGE SQL
BEGIN
declare v_date DATE;
declare v_sql01 varchar(1000);
--赋值v_date函数F_DATE_PRE()返回值
SELECT CRMSUINING.F_DATE_PRE() INTO v_date FROM SYSIBM.SYSDUMMY1;
--设定这个表的操作不记录日志,避免报错:日志已满
SET v_sql01='ALTER TABLE CRMSUINING.O_C03_P_GROUP_ALL ACTIVATE NOT LOGGED INITIALLY';
EXECUTE IMMEDIATE v_sql01;
SET v_sql01='
INSERT INTO CRMSUINING.O_C03_P_GROUP_ALL(CUST_ID,CUST_NAME,IDEN_TYPE_CD,IDEN_NO,GENDER_CD,BIRTH_DT,CORP_TELEPHONE_NO,HOME_PHONE,EMAIL_ADDR,HOME_ADDR
,HOME_POST_CODE,MOBILE_TELEPHONE,CORP_ADDR,MARRIAGE_STATUS_CD,CORP_NAME,NATION_CD,CUST_LEV,SEASON_AVG,LOAN_BAL)
SELECT
TRIM(DI.EC_CUST_NO)
,TRIM(DI.EC_FULL_NAM)
,TRIM(PGA.IDEN_TYPE_CD)
,TRIM(DI.EC_CER_NO)
,TRIM(PGA.GENDER_CD)
,TRIM(PGA.BIRTH_DT)
,TRIM(PGA.CORP_TELEPHONE_NO)
,TRIM(PGA.HOME_PHONE)
,TRIM(PGA.EMAIL_ADDR)
,TRIM(PGA.HOME_ADDR)
,TRIM(PGA.HOME_POST_CODE)
,TRIM(ADR.CI_MOBILE_PHONE)
,TRIM(PGA.CORP_ADDR)
,TRIM(PGA.MARRIAGE_STATUS_CD)
,TRIM(PGA.CORP_NAME)
,TRIM(PGA.NATION_CD)
,TRIM(PGA.CUST_LEV)
,TRIM(PGA.SEASON_AVG)
,TRIM(PGA.LOAN_BAL)
FROM CRMSUINING.S_T01_CBOD_ECCIFIDI DI
LEFT JOIN CRMSUINING.S_T01_CBOD_CICIFADR ADR ON ADR.FK_CICIF_KEY = DI.EC_CUST_NO AND ADR.CI_ADDR_COD=''MOB''
LEFT JOIN CRMSUINING.S_C03_P_GROUP_ALL PGA ON PGA.CUST_ID=DI.EC_CUST_NO AND PGA.STATIS_DT=''2017-08-31''';
EXECUTE IMMEDIATE v_sql01;
END
@
CALL CRMSUINING.SP_O_C03_P_GROUP_ALL()
@
调用存储过程时,会报错
CALL CRMSUINING.SP_O_C03_P_GROUP_ALL()
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=END-OF-STATEMENT;INING.S_C03_P_GROUP_;JOIN <joined_table>, DRIVER=4.18.60
Script: 脚本24.sql
Database Name: crm
Authorization Id (Database): db2inst1
System/IP Address : LAPTOP-9OMRLOIB/32.107.136.84
User Id (System) : ronaldo 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询