Oracle存储过程运行错误

时间:2015-06-22 19:31:59

标签: sql oracle compiler-errors oracle10g

我正在尝试Oracle的第一个存储过程,因为我之前的插入语句不起作用。我得到了这些奇怪的错误,我一直在谷歌搜索几个小时,似乎没有人纠正我的具体问题。

我只想添加记录:/

我的代码如下:

CREATE OR REPLACE Insert_classifieds 
 (val_date  IN      TABLENAME.Addate%type, 
  val_category    IN      TABLENAME.Category%type, 
  val_user    IN      TABLENAME.Username%type, 
  val_ phone  IN       TABLENAME.Phonenbr%type, 
  val_email  IN        TABLENAME.Email%type,
  val_shortDes  IN       TABLENAME.Description%type,
  val_longDes   IN      TABLENAME.Fulldescription%type ,
  val_newstandardid out TABLENAME.Classid%type
) 
as num_standardid number; 
begin  
    select t_class_seq.nextval into num_standardid from dual; 

    INSERT INTO TABLENAME (Classid, Addate, Category, Username, Phonenbr, Email, Description, Fulldescription)
    VALUES (num_standardid, val_date, val_category, val_user, val_phone, val_email, val_shortDes, val_longDes); 

    commit; 
    val_newstandardid := num_standardid; 
end;

2 个答案:

答案 0 :(得分:4)

如果您正在尝试创建一个过程,语法是(您错过了" PROCEDURE"关键字): CREATE OR REPLACE PROCEDURE Insert_classifieds

答案 1 :(得分:0)

所以我的问题是val_phone有一个空格和一些补救修正。

最后:

CREATE OR REPLACE PROCEDURE Insert_classifieds 
(val_date        TABLENAME.Addate%type,
  val_category         TABLENAME.Category%type, 
  val_user        TABLENAME.Username%type,  
  val_phone        TABLENAME.phonenbr%type,
  val_email         TABLENAME.Email%type,
  val_shortDes        TABLENAME.Description%type,
  val_longDes        TABLENAME.Fulldescription%type)  

as num_classid number; 

begin  

select t_class_seq.nextval into num_classid from dual;  

INSERT INTO TABLENAME (Classid, Addate, Category, Username, Phonenbr, Email, Description, Fulldescription) 
   values (num_classid, val_date, val_category, val_user, val_phone, val_email, val_shortDes, val_longDes);  

commit;  

end;