我正在給我的代碼的一小段代碼,但在嘗試爲存儲的Oracle PL SQL過程創建新訂單時收到下面的錯誤消息。 第83行是代碼中的插入語句,第84行是語句的插入部分。針對新的事務和訂單的PL SQL存儲過程
83/5 PL/SQL:SQL語句忽略
47分之84PL/SQL:ORA-00984:列在這裏
BEGIN
--Initializing values for variables
x_rowcount := 0;
x_stockonhand := 0;
Totaldue := 0;
--Total due calculation
--(price of phone*quantity + shipping cost)*1.06 (assuming 6% sales tax)
Totaldue := (((i_price * c_p_qty) + i_shipping_cost) * 1.06);
SAVEPOINT start_transaction; -- mark a savepoint
--INSERT a new record into order table.
INSERT INTO orders(o_id,c_id,p_id,s_id,order_date,o_qty,order_total,card_type,cc_number,exp_date,shipping_status)
VALUES (orders_seq.nextval, c_c_id,c_p_id,s_id,sysdate,c_p_qty,Totaldue,c_card_type,c_cc_number,c_exp_date,'Not shipped yet');
認爲您可能必須在插入前先獲得序列。所以也許就像插入前從orders中選擇orders_seq.nextval到myOrdersSeq中一樣; (當然你需要定義myOrdersSeq) –