1

我正在为某些维度编写一些 DDL/PLSQL,这样我就可以方便地将它作为备份,并且我正在使用过程/函数来自动化一切。对于我的问题,我关注的是日期维度。我遇到的问题是,当我尝试从另一个存储过程运行一个存储过程时,我收到一组错误消息,这些消息说,

  • [ORA-04068] 包的现有状态已被丢弃,未执行、更改或删除存储过程
  • [ORA-04065] 未执行、更改或删除存储过程“ADMIN.NEW_DATE”
  • [ORA-06508] PL/SQLL 找不到被调用的程序单元:“ADMIN.NEW_DATE”
  • [ORA-06512] 在“ADMIN.DATE_DIM_CREATE,第 85 行
  • [ORA-06512] 在第 2 行

我还应该指出,其中一个存储过程调用了一组函数来处理将插入日期维度表中的日期维度值。

这是第一个存储过程 DATE_DIM_CREATE 的代码,它调用 NEW_DATE:

create or replace 
PROCEDURE DATE_DIM_CREATE
    AUTHID CURRENT_USER
IS
    V_START_DATE DATE := TO_DATE('01/01/1900','MM/DD/YYYY');
    V_CURRENT_DATE  DATE := V_START_DATE;
    V_END_DATE DATE := TO_DATE('12/31/2099','MM/DD/YYYY');
BEGIN
    EXECUTE IMMEDIATE 'DROP TABLE "DATE_DIM" PURGE';

    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_LANGUAGE = ''AMERICAN'' ';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_TERRITORY = ''AMERICA'' ';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_CALENDAR = ''GREGORIAN'' ';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = ''MM/DD/YYYY'' ';

    EXECUTE IMMEDIATE
    'CREATE TABLE DATE_DIM
    (
        DATE_KEY NUMBER(8, 0) NOT NULL,  
        DATE_TYPE VARCHAR2(14),
        FULL_DATE DATE,
        FULL_DATE_REVERSE VARCHAR2(10),
        FULL_DATE_DESCRIPTION VARCHAR2(31),
        DAY_NUMBER NUMBER(2, 0),
        DAY_NAME VARCHAR2(9),
        DAY_SHORT VARCHAR2(3),
        FIRST_DAY_IN_MONTH DATE,
        LAST_DAY_IN_MONTH DATE,
        FIRST_DAY_IN_PREVIOUS_MONTH DATE,
        LAST_DAY_IN_PREVIOUS_MONTH DATE,
        FIRST_DAY_IN_NEXT_MONTH DATE,
        LAST_DAY_IN_NEXT_MONTH DATE,
        FIRST_DAY_IN_CALENDAR_QTR DATE,
        LAST_DAY_IN_CALENDAR_QTR DATE,
        FIRST_DAY_IN_PREV_CALENDAR_QTR DATE,
        LAST_DAY_IN_PREV_CALENDAR_QTR DATE,
        FIRST_DAY_IN_NEXT_CALENDAR_QTR DATE,
        LAST_DAY_IN_NEXT_CALENDAR_QTR DATE,
        FIRST_DAY_IN_CALENDAR_YEAR DATE,
        LAST_DAY_IN_CALENDAR_YEAR DATE,
        DAY_NUMBER_IN_CALENDAR_YEAR NUMBER(3, 0),
        FIRST_DAY_IN_FISCAL_QTR DATE,
        LAST_DAY_IN_FISCAL_QTR DATE,
        FIRST_DAY_IN_PREV_FISCAL_QTR DATE,
        LAST_DAY_IN_PREV_FISCAL_QTR DATE,
        FIRST_DAY_IN_NEXT_FISCAL_QTR DATE,
        LAST_DAY_IN_NEXT_FISCAL_QTR DATE,
        FIRST_DAY_IN_FISCAL_YEAR DATE,  
        LAST_DAY_IN_FISCAL_YEAR DATE,
        DAY_NUMBER_IN_FISCAL_YEAR NUMBER(3, 0),
        IS_WEEKDAY VARCHAR2(1),
        IS_WEEKEND VARCHAR2(1), 
        WEEK_IN_MONTH NUMBER(1, 0),
        WEEK_IN_CALENDAR_YEAR_ISO NUMBER(2, 0),
        WEEK_IN_FISCAL_YEAR_ISO NUMBER(2, 0),
        BEGIN_FULL_WEEK DATE,
        END_FULL_WEEK DATE,
        BEGIN_WORK_WEEK DATE,
        END_WORK_WEEK DATE,
        MONTH_NUMBER NUMBER(2, 0),
        MONTH_NAME VARCHAR(9),
        MONTH_SHORT VARCHAR(3),
        CALENDAR_QUARTER NUMBER(1, 0),
        CALENDAR_QUARTER_NAME VARCHAR2(11),
        CALENDAR_QUARTER_YEAR VARCHAR2(9),
        FISCAL_QUARTER NUMBER(1, 0),
        FISCAL_QUARTER_NAME VARCHAR2(11),
        FISCAL_QUARTER_YEAR VARCHAR2(9),
        CALENDAR_YEAR_NUMBER NUMBER(4, 0),
        CALENDAR_YEAR VARCHAR2(6),
        FISCAL_YEAR_NUMBER NUMBER(4, 0),
        FISCAL_YEAR VARCHAR2(6),
        IS_HOLIDAY VARCHAR2(1),
        IS_BUSINESS_DAY VARCHAR2(1),
        CONSTRAINT DATE_KEY_PK PRIMARY KEY (DATE_KEY)
    )';

EXECUTE IMMEDIATE
    'COMMENT ON TABLE DATE_DIM
    IS ''Date dimension table used for storing date attributes.'' ';
EXECUTE IMMEDIATE
    'COMMENT ON COLUMN DATE_DIM.DATE_KEY
    IS ''Date key is the primary/surrogate key for the date dimension table.'' ';

WHILE V_CURRENT_DATE <= V_END_DATE LOOP
    NEW_DATE(V_CURRENT_DATE);
    V_CURRENT_DATE := V_CURRENT_DATE + INTERVAL '1' DAY;
END LOOP;

NEW_DATE(TO_DATE('12/29/9999', 'MM/DD/YYYY'));
NEW_DATE(TO_DATE('12/30/9999', 'MM/DD/YYYY'));
NEW_DATE(TO_DATE('12/31/9999', 'MM/DD/YYYY'));

END DATE_DIM_CREATE;

这是 NEW_DATE 过程,它将值插入到表中并调用所有函数:

create or replace 
PROCEDURE NEW_DATE(P_DATE IN DATE)
    AUTHID CURRENT_USER
IS
BEGIN
    INSERT INTO DATE_DIM 
    (
        DATE_KEY,
        DATE_TYPE,
        FULL_DATE,
        FULL_DATE_REVERSE,
        FULL_DATE_DESCRIPTION,
        DAY_NUMBER,
        DAY_NAME,
        DAY_SHORT,
        FIRST_DAY_IN_MONTH,
        LAST_DAY_IN_MONTH,
        FIRST_DAY_IN_PREVIOUS_MONTH,
        LAST_DAY_IN_PREVIOUS_MONTH,
        FIRST_DAY_IN_NEXT_MONTH,
        LAST_DAY_IN_NEXT_MONTH,
        FIRST_DAY_IN_CALENDAR_QTR,
        LAST_DAY_IN_CALENDAR_QTR,
        FIRST_DAY_IN_PREV_CALENDAR_QTR,
        LAST_DAY_IN_PREV_CALENDAR_QTR,
        FIRST_DAY_IN_NEXT_CALENDAR_QTR,
        LAST_DAY_IN_NEXT_CALENDAR_QTR,
        FIRST_DAY_IN_CALENDAR_YEAR,
        LAST_DAY_IN_CALENDAR_YEAR,
        DAY_NUMBER_IN_CALENDAR_YEAR,
        FIRST_DAY_IN_FISCAL_QTR,
        LAST_DAY_IN_FISCAL_QTR,
        FIRST_DAY_IN_PREV_FISCAL_QTR,
        LAST_DAY_IN_PREV_FISCAL_QTR,
        FIRST_DAY_IN_NEXT_FISCAL_QTR,
        LAST_DAY_IN_NEXT_FISCAL_QTR,
        FIRST_DAY_IN_FISCAL_YEAR,
        LAST_DAY_IN_FISCAL_YEAR,
        DAY_NUMBER_IN_FISCAL_YEAR,
        IS_WEEKDAY,
        IS_WEEKEND,
        WEEK_IN_MONTH,
        WEEK_IN_CALENDAR_YEAR_ISO,
        WEEK_IN_FISCAL_YEAR_ISO,
        BEGIN_FULL_WEEK,
        END_FULL_WEEK,
        BEGIN_WORK_WEEK,
        END_WORK_WEEK,
        MONTH_NUMBER,
        MONTH_NAME,
        MONTH_SHORT,
        CALENDAR_QUARTER,
        CALENDAR_QUARTER_NAME,
        CALENDAR_QUARTER_YEAR,
        FISCAL_QUARTER,
        FISCAL_QUARTER_NAME,
        FISCAL_QUARTER_YEAR,
        CALENDAR_YEAR_NUMBER,
        CALENDAR_YEAR,
        FISCAL_YEAR_NUMBER,
        FISCAL_YEAR,
        IS_HOLIDAY,
        IS_BUSINESS_DAY
    ) 
    VALUES 
    (
        DATE_KEY_FX(P_DATE),                  --DATE_KEY
        DATE_TYPE_FX(P_DATE),                 --DATE_TYPE
        P_DATE,                               --FULL_DATE
        FULL_DATE_REVERSE_FX(P_DATE),         --FULL_DATE_REVERSE
        FULL_DATE_DESCRIPTION_FX(P_DATE),     --FULL_DATE_DESCRIPTION
        DAY_NUMBER_FX(P_DATE),                --DAY_NUMBER
        DAY_NAME_FX(P_DATE),                  --DAY_NAME
        DAY_SHORT_FX(P_DATE),                 --DAY_SHORT
        DAY_IN_MONTH_FX(P_DATE, 0, 0),        --FIRST_DAY_IN_MONTH
        DAY_IN_MONTH_FX(P_DATE, 1, 0),        --LAST_DAY_IN_MONTH
        DAY_IN_MONTH_FX(P_DATE, 0, -1),       --FIRST_DAY_IN_PREVIOUS_MONTH
        DAY_IN_MONTH_FX(P_DATE, 1, -1),       --LAST_DAY_IN_PREVIOUS_MONTH
        DAY_IN_MONTH_FX(P_DATE, 0, 1),        --FIRST_DAY_IN_NEXT_MONTH
        DAY_IN_MONTH_FX(P_DATE, 1, 1),        --LAST_DAY_IN_NEXT_MONTH
        DAY_IN_QTR_FX(P_DATE, 0, 0, 0),       --FIRST_DAY_IN_CALENDAR_QTR
        DAY_IN_QTR_FX(P_DATE, 1, 0, 0),       --LAST_DAY_IN_CALENDAR_QTR
        DAY_IN_QTR_FX(P_DATE, 0, -1, 0),      --FIRST_DAY_IN_PREV_CALENDAR_QTR
        DAY_IN_QTR_FX(P_DATE, 1, -1, 0),      --LAST_DAY_IN_PREV_CALENDAR_QTR
        DAY_IN_QTR_FX(P_DATE, 0, 1, 0),       --FIRST_DAY_IN_NEXT_CALENDAR_QTR
        DAY_IN_QTR_FX(P_DATE, 1, 1, 0),       --LAST_DAY_IN_NEXT_CALENDAR_QTR
        DAY_IN_YEAR_FX(P_DATE, 0, 0),         --FIRST_DAY_IN_CALENDAR_YEAR
        DAY_IN_YEAR_FX(P_DATE, 1, 0),         --LAST_DAY_IN_CALENDAR_YEAR
        DAY_NUMBER_IN_YEAR_FX(P_DATE, 0),     --DAY_NUMBER_IN_CALENDAR_YEAR
        DAY_IN_QTR_FX(P_DATE, 0, 0, 1),       --FIRST_DAY_IN_FISCAL_QTR
        DAY_IN_QTR_FX(P_DATE, 1, 0, 1),       --LAST_DAY_IN_FISCAL_QTR
        DAY_IN_QTR_FX(P_DATE, 0, -1, 1),      --FIRST_DAY_IN_PREV_FISCAL_QTR
        DAY_IN_QTR_FX(P_DATE, 1, -1, 1),      --LAST_DAY_IN_PREV_FISCAL_QTR
        DAY_IN_QTR_FX(P_DATE, 0, 1, 1),       --FIRST_DAY_IN_NEXT_FISCAL_QTR
        DAY_IN_QTR_FX(P_DATE, 1, 1, 1),       --LAST_DAY_IN_NEXT_FISCAL_QTR
        DAY_IN_YEAR_FX(P_DATE, 0, 1),         --FIRST_DAY_IN_FISCAL_YEAR
        DAY_IN_YEAR_FX(P_DATE, 1, 1),         --LAST_DAY_IN_FISCAL_YEAR
        DAY_NUMBER_IN_YEAR_FX(P_DATE, 1),     --DAY_NUMBER_IN_FISCAL_YEAR
        IS_WEEKDAY_FX(P_DATE),                --IS_WEEKDAY
        IS_WEEKEND_FX(P_DATE),                --IS_WEEKEND
        WEEK_IN_MONTH_FX(P_DATE),             --WEEK_IN_MONTH
        WEEK_IN_YEAR_ISO_FX(P_DATE, 0),       --WEEK_IN_CALENDAR_YEAR_ISO
        WEEK_IN_YEAR_ISO_FX(P_DATE, 1),       --WEEK_IN_FISCAL_YEAR_ISO
        WEEK_POINT_FX(P_DATE, 0, 0),          --BEGIN_FULL_WEEK
        WEEK_POINT_FX(P_DATE, 1, 0),          --END_FULL_WEEK
        WEEK_POINT_FX(P_DATE, 0, 1),          --BEGIN_WORK_WEEK
        WEEK_POINT_FX(P_DATE, 1, 1),          --END_WORK_WEEK
        MONTH_NUMBER_FX(P_DATE),              --MONTH_NUMBER
        MONTH_NAME_FX(P_DATE),                --MONTH_NAME
        MONTH_SHORT_FX(P_DATE),               --MONTH_SHORT
        QUARTER_FX(P_DATE, 0),                --CALENDAR_QUARTER
        QUARTER_NAME_FX(P_DATE, 0),           --CALENDAR_QUARTER_NAME
        QUARTER_YEAR_FX(P_DATE, 0),           --CALENDAR_QUARTER_YEAR
        QUARTER_FX(P_DATE, 1),                --FISCAL_QUARTER
        QUARTER_NAME_FX(P_DATE, 1),           --FISCAL_QUARTER_NAME
        QUARTER_YEAR_FX(P_DATE, 1),           --FISCAL_QUARTER_YEAR
        YEAR_NUMBER_FX(P_DATE, 0),            --CALENDAR_YEAR_NUMBER
        YEAR_FORMAT_FX(P_DATE, 0),            --CALENDAR_YEAR
        YEAR_NUMBER_FX(P_DATE, 1),            --FISCAL_YEAR_NUMBER
        YEAR_FORMAT_FX(P_DATE, 1),            --FISCAL_YEAR
        IS_HOLIDAY_FX(P_DATE),                --IS_HOLIDAY
        IS_BUSINESS_DAY_FX(P_DATE)            --IS_BUSINESSDAY
    );

END NEW_DATE;

我不确定是否需要在存储过程中放置EXECUTE IMMEDIATE​​,INSERT INTONEW_DATE这样做对我当前的问题没有任何影响。

另外,我不是 DBA,所以我确信我的代码有一百万个问题。但是,如果有一种方法可以解决错误并让代码工作,同时仍然使用底层技术(一个存储过程调用另一个调用一堆函数的存储过程),那么这就是我最终要实现的一些协助。

更新 #1 似乎将INSERT INTO语句封装NEW_DATE在动态 SQL 中的过程中有所帮助。但是,它引入了以下新错误:

  • ORA-00984: 此处不允许列
  • ORA-06512: 在“ADMIN.NEW_DATE”,第 5 行
  • ORA-06512: 在第 6 行

这些新错误是否可能是由于我在程序部分中使用P_DATE参数引起的?如果是这样,我将如何更改它以允许使用该参数?我尝试了以下方法,但收到了相同的错误消息(关注 FULL_DATE 列)VALUESNEW_DATE

EXECUTE IMMEDIATE
    'INSERT INTO
     (
         DATE_TYPE,
         FULL_DATE,
         FULL_DATE_REVERSE
     )
     VALUES
     (
         DATE_TYPE_FX(P_DATE),               --DATE_TYPE
         '|| P_DATE ||',                     --FULL_DATE
         FULL_DATE_REVERSE_FX(P_DATE)        --FULL_DATE_REVERSE
     )';

谢谢

4

2 回答 2

1

ORA-04068 消息表明依赖程序单元已失效(未编译)。除其他外,当该程序单元的依赖项受到 DDL 影响时,就会发生这种情况。

您有一个删除并重新创建表的过程,以及另一个填充该表的过程。当您运行第一个过程时,它的 DDL 会使第二个过程无效。

但是您的第一个过程调用了第二个过程,而这种依赖性是问题的根源。

尽管可以说问题的真正根源是有一个删除并重新创建表的过程。很少有真正需要这样做的真实案例。大多数情况下,这种方法只是想象力的失败。

但是,如果您真的喜欢这个想法,您还需要将 NEW_DATE 插入语句包装在动态 SQL 中。这将破坏依赖关系树并防止表被删除时失效。


“所以我需要在 NEW_DATE 过程中将 INSERT INTO 语句包装在动态 SQL 中”

是的。NEW_DATE() 对 DATE_DIM 具有编译时间依赖性,因为 INSERT 是静态 SQL。当您删除表时,该过程无效。如果您使 INSERT 语句成为动态 SQL 调用,则依赖项将进入运行时。这意味着 NEW_DATE() 在您删除表时不会失效。事实上,如果表不存在,你仍然可以执行;它只会抛出 ORA-00904 或类似错误。

那么,为什么我们不让我们的所有程序都使用动态 SQL,从而消除 ORA-04068 消息的诅咒呢?因为动态 SQL 很难写,尤其是调试。此外,我们从依赖项中丢失了一些价值信息,这使得对数据库更改的影响分析变得更加困难。此外,做你正在做的事情,并将 DDL 放入可重复的编程过程中通常是不必要的。


“你认为参数是我收到的 column not allowed here 错误的原因吗?”

绝对地。这是一个字符串文字,EXECUTE IMMEDIATE在 SQL 引擎中按字面意思运行它。P_DATE是一个 PL/SQL 参数,超出了 SQL 的范围。

如果要传递参数,则需要使用正确的语法:

EXECUTE IMMEDIATE
    'INSERT INTO
     (
         DATE_TYPE,
         FULL_DATE,
         FULL_DATE_REVERSE
     )
     VALUES
     (
         DATE_TYPE_FX(:1),               --DATE_TYPE
         :2,                     --FULL_DATE
         FULL_DATE_REVERSE_FX(:3)        --FULL_DATE_REVERSE
     )' using p_date, p_date, p_date;

请注意,占位符就是这样。如果要在 27 个位置中使用相同的值,则需要在 USING 子句中使用 27 个占位符和 27 个匹配项。


我认为,如果您对动态 SQL 有任何疑问,您的第一个呼叫端口应该是文档。 在这里找到它。如果这对您没有帮助,请开始一个新的主题。

于 2013-07-08T21:08:33.780 回答
0
create or replace 
PROCEDURE DATE_DIM_CREATE
    AUTHID CURRENT_USER
IS
    V_START_DATE DATE := TO_DATE('01/01/1900','MM/DD/YYYY');
    V_CURRENT_DATE  DATE := V_START_DATE;
    V_END_DATE DATE := TO_DATE('12/31/2099','MM/DD/YYYY');
BEGIN
    EXECUTE IMMEDIATE 'DROP TABLE "DATE_DIM" PURGE'; <-- <b>you can use if exists function so you dont get an error saying date_dim not found 

    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_LANGUAGE = ''AMERICAN'' ';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_TERRITORY = ''AMERICA'' ';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_CALENDAR = ''GREGORIAN'' ';
    EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = ''MM/DD/YYYY'' ';

    EXECUTE IMMEDIATE
    'CREATE TABLE DATE_DIM
    (
        DATE_KEY NUMBER(8, 0) NOT NULL,  
        DATE_TYPE VARCHAR2(14),
        FULL_DATE DATE,
        FULL_DATE_REVERSE VARCHAR2(10),
        FULL_DATE_DESCRIPTION VARCHAR2(31),
        DAY_NUMBER NUMBER(2, 0),
        DAY_NAME VARCHAR2(9),
        DAY_SHORT VARCHAR2(3),
        FIRST_DAY_IN_MONTH DATE,
        LAST_DAY_IN_MONTH DATE,
        FIRST_DAY_IN_PREVIOUS_MONTH DATE,
        LAST_DAY_IN_PREVIOUS_MONTH DATE,
        FIRST_DAY_IN_NEXT_MONTH DATE,
        LAST_DAY_IN_NEXT_MONTH DATE,
        FIRST_DAY_IN_CALENDAR_QTR DATE,
        LAST_DAY_IN_CALENDAR_QTR DATE,
        FIRST_DAY_IN_PREV_CALENDAR_QTR DATE,
        LAST_DAY_IN_PREV_CALENDAR_QTR DATE,
        FIRST_DAY_IN_NEXT_CALENDAR_QTR DATE,
        LAST_DAY_IN_NEXT_CALENDAR_QTR DATE,
        FIRST_DAY_IN_CALENDAR_YEAR DATE,
        LAST_DAY_IN_CALENDAR_YEAR DATE,
        DAY_NUMBER_IN_CALENDAR_YEAR NUMBER(3, 0),
        FIRST_DAY_IN_FISCAL_QTR DATE,
        LAST_DAY_IN_FISCAL_QTR DATE,
        FIRST_DAY_IN_PREV_FISCAL_QTR DATE,
        LAST_DAY_IN_PREV_FISCAL_QTR DATE,
        FIRST_DAY_IN_NEXT_FISCAL_QTR DATE,
        LAST_DAY_IN_NEXT_FISCAL_QTR DATE,
        FIRST_DAY_IN_FISCAL_YEAR DATE,  
        LAST_DAY_IN_FISCAL_YEAR DATE,
        DAY_NUMBER_IN_FISCAL_YEAR NUMBER(3, 0),
        IS_WEEKDAY VARCHAR2(1),
        IS_WEEKEND VARCHAR2(1), 
        WEEK_IN_MONTH NUMBER(1, 0),
        WEEK_IN_CALENDAR_YEAR_ISO NUMBER(2, 0),
        WEEK_IN_FISCAL_YEAR_ISO NUMBER(2, 0),
        BEGIN_FULL_WEEK DATE,
        END_FULL_WEEK DATE,
        BEGIN_WORK_WEEK DATE,
        END_WORK_WEEK DATE,
        MONTH_NUMBER NUMBER(2, 0),
        MONTH_NAME VARCHAR(9),
        MONTH_SHORT VARCHAR(3),
        CALENDAR_QUARTER NUMBER(1, 0),
        CALENDAR_QUARTER_NAME VARCHAR2(11),
        CALENDAR_QUARTER_YEAR VARCHAR2(9),
        FISCAL_QUARTER NUMBER(1, 0),
        FISCAL_QUARTER_NAME VARCHAR2(11),
        FISCAL_QUARTER_YEAR VARCHAR2(9),
        CALENDAR_YEAR_NUMBER NUMBER(4, 0),
        CALENDAR_YEAR VARCHAR2(6),
        FISCAL_YEAR_NUMBER NUMBER(4, 0),
        FISCAL_YEAR VARCHAR2(6),
        IS_HOLIDAY VARCHAR2(1),
        IS_BUSINESS_DAY VARCHAR2(1),
        CONSTRAINT DATE_KEY_PK PRIMARY KEY (DATE_KEY)
    )

/
COMMENT ON TABLE DATE_DIM
IS ''用于存储日期属性的日期维度表。''
/
COMMENT ON COLUMN DATE_DIM.DATE_KEY
IS ''日期键是日期维度表的主键/代理键。'' ';

WHILE V_CURRENT_DATE <= V_END_DATE LOOP
    NEW_DATE(V_CURRENT_DATE);
    V_CURRENT_DATE := V_CURRENT_DATE + INTERVAL '1' DAY;
END LOOP;

这是你应该做的..你应该调用程序
exec NEW_DATE;
NEW_DATE(TO_DATE('12/29/9999', 'MM/DD/YYYY'));
NEW_DATE(TO_DATE('12/30/9999', 'MM/DD/YYYY'));
NEW_DATE(TO_DATE('12/31/9999', 'MM/DD/YYYY'));

END DATE_DIM_CREATE;<br/>


我目前没有 plsql 来检查它,但你的问题是你没有以正确的方式调用程序。方式是 excec NEW_DATe\e。我应该提到我已经更正了 create table 中的一些内容,您可以在 create table 中包含注释

于 2013-07-08T19:47:27.797 回答