【问题标题】:Keep getting an error and do not understand why一直报错,不明白为什么
【发布时间】:2014-08-16 03:08:09
【问题描述】:

sales_heads 编译时不会出现错误,但是当我尝试编译 sales_lines 时会出现 2 个错误:

  1. 错误(3,1):PL/SQL:SQL 语句被忽略

  2. 错误(3,111):PL/SQL:ORA-02289:序列不存在

谁能告诉我哪里出错了。


drop sequence nsale_seq;

CREATE SEQUENCE nsale_seq
 START WITH     1000000000
 INCREMENT BY   1
 NOCACHE
 NOCYCLE;

create or replace PROCEDURE sale_heads (staffID_new number, customerID_new number)
is begin
insert into SALE_HEAD (sale_num, sale_date, status, staff_id, customer_id) values (nsale_seq.NEXTVAL, sysdate, 'P', staffID_new, customerID_new);
end sale_heads;
/


create or replace PROCEDURE sales_lines (productCode_new number, quantity_new number, actualPrice_new number) is
begin
insert into SALE_LINE (actual_price, quantity, sale_num, product_code) values (actualPrice_new, quantity_new, nsale_seg.CURRVAL, productCode_new);
end sales_lines;
/

【问题讨论】:

    标签: plsql sequence procedure


    【解决方案1】:

    您已在您的第一个程序以及第二个程序之后放置// 用于显示文件的结尾或要执行的语句!因此找不到第二个过程!!!

    这就是您的第二个过程被忽略的原因。

    请在第一个过程sale_heads 之后删除/ 的第一个斜杠。

    我相信它会完美运行!

    【讨论】:

    • 它消除了两个错误,但是现在出现了一个新错误,它出现了错误'Error(8,1): PLS-00103: Encountered the symbol "CREATE" '
    • @HarryMinhas-你确定这个文件里没有其他代码吗???如果是这样,请尝试删除第二个/!另外,由于有两个程序,所以你原来的陈述要好得多。在您回答此问题后,我会为您编辑答案!
    猜你喜欢
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 2013-03-19
    • 2013-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多