为什么存储过程阶段错误在CLI上可以正常工作?

问题描述 投票:0回答:2

我有一个存储过程,我已经用Begin StoredProcedureName尝试了我的存储过程;结束;在My CLI中,它是成功的。我的存储过程完全正常且完美。

CREATE OR REPLACE PROCEDURE "SCHEMA"."TEST_SP"
IS
    BACKDATE_BUSSDATE DATE;
    VAR VARCHAR2(4000);
BEGIN

    --- SET VARIABLE END OF MONTH ---
    SELECT EOMLASTMONTH 
    INTO BACKDATE_BUSSDATE
    FROM DIM_DATE WHERE TO_DATE(BUS_DT,'DD/MM/YYYY') = TO_DATE(SYSDATE-1,'DD/MM/YYYY');

    -- TRUNCATE TABLE TEMP
    VAR := 'TRUNCATE TABLE TEMP_INSERT_BACKDATE_HIPORT';
    EXECUTE IMMEDIATE VAR;

    --- INSERT DATA KE TEMP TABLE YG DI BUAT ---
    INSERT INTO TEMP_INSERT_BACKDATE_HIPORT
    SELECT CURR.BUSINESS_NUMBER,CURR.PERSON_NUMBER,CURR.ACCOUNT_SOURCE,CURR.PRODUCT_CODE,CURR.CONTAINER_NUMBER,CURR.CURRENCY_CODE,CURR.EXCHANGE_RATE,CURR.QUANTITY,CURR.MARKET_PRICE,CURR.MARKET_PRICE_DATE,CURR.PURCHASE_PRICE,CURR.PURCHASE_VALUE,CURR.CURRENT_BALANCE_ORG_AMOUNT,CURR.CURRENT_BALANCE_IDR_AMOUNT,CURR.TOTAL_DEBIT_AMOUNT,CURR.TOTAL_CREDIT_AMOUNT,CURR.LAST_MONTH_BALANCE_ORG_AMOUNT,CURR.PROFIT_LOSS_POTENTIAL_PCT,CURR.SUM_INSURED_AMOUNT,CURR.CASH_BLOCKING_FLAG,CURR.CASH_BLOCKING_REASON,CURR.INTEREST_RATE,CURR.INTEREST_TYPE_CODE,CURR.ACCRUED_INTEREST,CURR.PAYMENT_DATE,CURR.PROCESS
    FROM (SELECT * FROM TEST
    WHERE ACCOUNT_SOURCE = 'HIPORT' 
    AND BUSINESS_DATE = TO_DATE(SYSDATE-1,'DD/MM/YYYY')) CURR
    LEFT JOIN (SELECT * FROM TEST
    WHERE ACCOUNT_SOURCE = 'HIPORT' 
    AND TO_DATE(BUSINESS_DATE) = TO_DATE(SYSDATE-2)) EOM
    ON EOM.BUSINESS_NUMBER = CURR.BUSINESS_NUMBER 
    AND EOM.PERSON_NUMBER = CURR.PERSON_NUMBER 
    AND EOM.ACCOUNT_SOURCE = CURR.ACCOUNT_SOURCE 
    AND EOM.PRODUCT_CODE = CURR.PRODUCT_CODE
    WHERE EOM.BUSINESS_NUMBER IS NULL;

    --- INSERT DATA KE FACT WM POSITION DARI TEMP TABLE ---
    LOOP
         DBMS_OUTPUT.PUT_LINE(BACKDATE_BUSSDATE);
         DBMS_OUTPUT.PUT_LINE( 'INSERT INTO TEST(BUSINESS_DATE,BUSINESS_NUMBER,PERSON_NUMBER,ACCOUNT_SOURCE,PRODUCT_CODE,CONTAINER_NUMBER,CURRENCY_CODE,EXCHANGE_RATE,QUANTITY,MARKET_PRICE,MARKET_PRICE_DATE,PURCHASE_PRICE,PURCHASE_VALUE,CURRENT_BALANCE_ORG_AMOUNT,CURRENT_BALANCE_IDR_AMOUNT,TOTAL_DEBIT_AMOUNT,TOTAL_CREDIT_AMOUNT,LAST_MONTH_BALANCE_ORG_AMOUNT,PROFIT_LOSS_POTENTIAL_PCT,SUM_INSURED_AMOUNT,CASH_BLOCKING_FLAG,CASH_BLOCKING_REASON,INTEREST_RATE,INTEREST_TYPE_CODE,ACCRUED_INTEREST,PAYMENT_DATE,PROCESS_NAME,INSERT_DATE)'
                            || 'SELECT TO_DATE('''|| BACKDATE_BUSSDATE || ''',''DD-MM-YYYY''),BUSINESS_NUMBER,PERSON_NUMBER,ACCOUNT_SOURCE,PRODUCT_CODE,CONTAINER_NUMBER,CURRENCY_CODE,EXCHANGE_RATE,QUANTITY,MARKET_PRICE,MARKET_PRICE_DATE,PURCHASE_PRICE,PURCHASE_VALUE,CURRENT_BALANCE_ORG_AMOUNT,CURRENT_BALANCE_IDR_AMOUNT,TOTAL_DEBIT_AMOUNT,TOTAL_CREDIT_AMOUNT,LAST_MONTH_BALANCE_ORG_AMOUNT,PROFIT_LOSS_POTENTIAL_PCT,SUM_INSURED_AMOUNT,CASH_BLOCKING_FLAG,CASH_BLOCKING_REASON,INTEREST_RATE,INTEREST_TYPE_CODE,ACCRUED_INTEREST,PAYMENT_DATE,PROCESS,TO_DATE(SYSDATE)'
                             || 'FROM TEMP_INSERT');
         EXECUTE IMMEDIATE  'INSERT INTO TEST (BUSINESS_DATE,BUSINESS_NUMBER,PERSON_NUMBER,ACCOUNT_SOURCE,PRODUCT_CODE,CONTAINER_NUMBER,CURRENCY_CODE,EXCHANGE_RATE,QUANTITY,MARKET_PRICE,MARKET_PRICE_DATE,PURCHASE_PRICE,PURCHASE_VALUE,CURRENT_BALANCE_ORG_AMOUNT,CURRENT_BALANCE_IDR_AMOUNT,TOTAL_DEBIT_AMOUNT,TOTAL_CREDIT_AMOUNT,LAST_MONTH_BALANCE_ORG_AMOUNT,PROFIT_LOSS_POTENTIAL_PCT,SUM_INSURED_AMOUNT,CASH_BLOCKING_FLAG,CASH_BLOCKING_REASON,INTEREST_RATE,INTEREST_TYPE_CODE,ACCRUED_INTEREST,PAYMENT_DATE,PROCESS_NAME,INSERT_DATE)'
                            || 'SELECT TO_DATE('''|| BACKDATE_BUSSDATE || ''',''DD-MM-YYYY''),BUSINESS__NUMBER,PERSON_NUMBER,ACCOUNT_SOURCE,PRODUCT_CODE,CONTAINER_NUMBER,CURRENCY_CODE,EXCHANGE_RATE,QUANTITY,MARKET_PRICE,MARKET_PRICE_DATE,PURCHASE_PRICE,PURCHASE_VALUE,CURRENT_BALANCE_ORG_AMOUNT,CURRENT_BALANCE_IDR_AMOUNT,TOTAL_DEBIT_AMOUNT,TOTAL_CREDIT_AMOUNT,LAST_MONTH_BALANCE_ORG_AMOUNT,PROFIT_LOSS_POTENTIAL_PCT,SUM_INSURED_AMOUNT,CASH_BLOCKING_FLAG,CASH_BLOCKING_REASON,INTEREST_RATE,INTEREST_TYPE_CODE,ACCRUED_INTEREST,PAYMENT_DATE,PROCESS,TO_DATE(SYSDATE)'
                             || 'FROM TEMP_INSERT';
         BACKDATE_BUSSDATE := TO_DATE(BACKDATE_BUSSDATE+1,'DD/MM/YYYY');
         EXIT WHEN TO_DATE(BACKDATE_BUSSDATE,'DD/MM/YYYY') = TO_DATE(SYSDATE-1,'DD/MM/YYYY');
    END LOOP;
END;

我试图将我的存储过程置于DataStage的存储过程阶段。我的工作设计看起来像这样

Oracle Connector=>Transformer=>Oracle Connector=>Stored Procedure

使用0数据,作业运行完美。当我尝试使用1个或更多数据时,它给我一个错误ORA-6512。是不是来自Oracle错误的“ ORA-xxxx”错误?但是我运行我的Oracle存储过程,并完美完成了。

我的存储过程阶段配置看起来像这样

语法:程序名称:TEST_SP程序类型:转换生成过程调用:已选中(我尝试过手动“未选中”,结果仍然相同)

数据连接:(空)

一般:我已经填写了所有凭据

输入中:对每一行执行步骤(选中)专栏:我从变压器全部拿走

请任何人有任何想法吗?我已经很困了。

编辑:当我将存储过程阶段更改为“目标”时,这是消息

Stored_Procedure_5,0:致命错误:致命:ORA-06550:第1行,第7列:PLS-00306:调用'TEST_SP'时参数或参数类型错误ORA-06550:第1行,第7列:PL / SQL :语句被忽略存储过程错误

这是当我转换为转换时的消息

Stored_Procedure_5,0:致命错误:致命:ORA-01858:在期望数字的地方找到了非数字字符ORA-06512:在“ SCHEMA.TEST_SP”,第8行ORA-06512:在第1行]]

我有一个存储过程,我已经用Begin StoredProcedureName尝试了我的存储过程;结束;在My CLI中,它是成功的。我的存储过程绝对完美,完美。创建或...

oracle etl data-warehouse datastage
2个回答
0
投票

您的问题很可能是这样:

TO_DATE(SYSDATE-1,'DD/MM/YYYY');

0
投票

用这么多击败我!!! :)

© www.soinside.com 2019 - 2024. All rights reserved.