Oracle APEX PL / SQL错误

时间:2017-09-12 14:13:01

标签: sql oracle plsql oracle-apex literals

我有这个PL / SQL声明:

BEGIN
    DELETE FROM REI_RETAIL_FACTOR_PARTS P
    WHERE  DEALER_NUMBER = :P13_FILTER_DEALER;

    INSERT INTO REI_RETAIL_FACTOR_PARTS
    (
        SELECT
            RF.TEILE_NR as "PART_NR",
            :P13_OVERWRITE_VALUE as "REQUESTED_RATE",
            sysdate as "REQUEST_DATE",
            :P13_FILTER_DEALER as "DEALER_NUMBER"
        FROM REI_RETAIL_FACTOR RF
        WHERE DEALER_NUMBER = :P13_FILTER_DEALER
    );
END;

错误是:

  

ORA-01861:文字与格式字符串不匹配。

这真是令人沮丧,因为我从不尝试格式化任何东西。 那么,为什么我一直都会收到这个错误?

1 个答案:

答案 0 :(得分:0)

  

ORA-01861:文字与格式字符串不匹配。

您的INSERT语法错误。可能的解决方案:

a)定义列列表:

BEGIN
    DELETE FROM REI_RETAIL_FACTOR_PARTS P
    WHERE  DEALER_NUMBER = :P13_FILTER_DEALER;

    INSERT INTO REI_RETAIL_FACTOR_PARTS(column_name1, ...)
        SELECT
            RF.TEILE_NR as "PART_NR",
            :P13_OVERWRITE_VALUE as "REQUESTED_RATE",
            sysdate as "REQUEST_DATE",
            :P13_FILTER_DEALER as "DEALER_NUMBER"
        FROM REI_RETAIL_FACTOR RF
        WHERE DEALER_NUMBER = :P13_FILTER_DEALER;
END;

b)删除()(警告!选择中的列顺序至关重要):

BEGIN
    DELETE FROM REI_RETAIL_FACTOR_PARTS P
    WHERE  DEALER_NUMBER = :P13_FILTER_DEALER;

    INSERT INTO REI_RETAIL_FACTOR_PARTS
        SELECT
            RF.TEILE_NR as "PART_NR",
            :P13_OVERWRITE_VALUE as "REQUESTED_RATE",
            sysdate as "REQUEST_DATE",
            :P13_FILTER_DEALER as "DEALER_NUMBER"
        FROM REI_RETAIL_FACTOR RF
        WHERE DEALER_NUMBER = :P13_FILTER_DEALER;
END;