SQLPLUS如何修复此过程以使其正常工作?

时间:2014-11-09 17:00:14

标签: oracle stored-procedures plsql pls-00103

好的。我从课堂上复制了这段代码,但我当时一定是半睡半醒,因为它实际上没有用。

Create or replace procedure display_row is
    (p_itemid IN item.itemid%TYPE) is
    v_itemid Number;
    v_itemdesc varchar2(30);
    v_category varchar2(30);
Begin
    Select *
    Into v_itemid, v_itemdesc, v_category
    From item
    Where itemid = p_itemid;
    Dbms_output.put_line(v_itemid || ' ' || v_itemdesc || ' ' || v_category);
End;

如何修复此程序以使其真正起作用?

以下是用户错误:

LINE   POSITION TEXT

     2          6 PLS-00103: Encountered the symbol "(" when expecting one of
                  the following:

                     begin function package pragma procedure subtype type use
                     <an identifier> <a double-quoted delimited-identifier> fo
                  rm
                     current cursor external language

     2         37 PLS-00103: Encountered the symbol "IS" when expecting one of
                   the following:

                     return

1 个答案:

答案 0 :(得分:1)

从第一句

中删除is运算符
Create or replace procedure display_row is 
                                        <--Here    

您的程序应该是

Create or replace procedure display_row
    (p_itemid IN item.itemid%TYPE) is
    v_itemid Number;
    v_itemdesc varchar2(30);
    v_idemdesc varchar2(30);
Begin
    Select *
    Into v_itemid, v_itemdesc, v_category
    From item
    Where itemid = p_itemid;
    Dbms_output.put_line(v_itemid || ' ' || v_itemdesc || ' ' || v_category);
End;