新SQL事务和订单的PL SQL存储过程

时间:2015-11-13 18:57:17

标签: oracle variables plsql insert

我正在提供一小段代码,但在尝试为存储的Oracle pl sql过程创建新订单时,我收到以下错误。 第83行是代码中的insert语句,第84行是语句的插入部分。

83/5 PL / SQL:忽略SQL语句
84/47 PL / 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'); 

2 个答案:

答案 0 :(得分:0)

检查您的申报部分。通常,当您在变量名称或未声明的变量中输入拼写错误时,会出现此错误。例如:

SQL> create table tmp (id number, str varchar2(100));

Table created.

SQL> declare
 a number;
begin
  insert into tmp (id, str)
  values (a, a1);
end;
/  
  values (a, a1);
             *
ERROR at line 5:
ORA-06550: line 5, column 14:
PL/SQL: ORA-00984: column not allowed here
ORA-06550: line 4, column 3:
PL/SQL: SQL Statement ignored

答案 1 :(得分:0)

错误是因为<select [(ngModel)]="selectedDevice" (change)="onChange($event)"> <option *ngFor="#i of devices">{{i}}</option> </select> onChange($event) { console.log(this.selectedDevice); // I want to do something here for new selectedDevice, but what I // got here is always last selection, not the one I just select. } 部分中的一个或多个值无效。

我建议检查每一个,看看它们是否有效。例如,是VALUES(...,...)声明并在代码中的其他位置给出值吗?如果没有,这可能是你的问题。每个都需要声明并赋值,然后才能将其放入c_c_id语句的VALUES(...,...)部分。

INSERT