我写了这个脚本,但它不起作用。我没有收到任何错误消息,它只是挂起,你能帮我吗?
DECLARE
vYear_ID VARCHAR(4);
vQuarter CHARACTER(6);
vMonth_Num SMALLINT;
vMonth_Name VARCHAR(20);
vWeekday_Num SMALLINT;
vWeekday_Name VARCHAR(20);
vStartDate Date := '01/01/1998';
vEndDate Date := '31/12/2002';
vDate_ID Date;
vDate_ID := vStartDate;
BEGIN
WHILE vDate_ID < vEndDate
LOOP
vYear_ID := TO_CHAR(vDate_ID,'YYYY');
vQuarter := TO_CHAR(vDate_ID,'YYYY')||'Q'||TO_CHAR(vDate_ID,'Q');
vMonth_Num := TO_NUMBER(TO_CHAR(vDate_ID,'MM'));
vMonth_Name := TO_CHAR(vDate_ID,'Month');
vWeekday_Num := TO_NUMBER(TRIM(leading '0' FROM TO_CHAR(vDate_ID,'D')));
vWeekday_Name := TO_CHAR(vDate_ID,'Day');
INSERT INTO Time_Dim VALUES (vDate_ID, vYear_ID, vQuarter, vMonth_Name, vWeekday_Name, vMonth_Num, );
vDate_ID = to_date(vDate_ID,'DD/MM/YYYY')+1
END LOOP;
END;
我必须使用 While 循环而不是 For。
提前致谢。