首页 > 解决方案 > 我的包裹体有什么问题??甲骨文 SQLPLUS

问题描述


我是 oracle 的新手,一直在研究导致错误的包体。

(供参考)我的表是:

CREATE TABLE CUSTOMERS
(custname VARCHAR2(10),
account_no NUMBER(5),
cur_balance NUMBER(6)
)
/

我的包裹是:

CREATE OR REPLACE PACKAGE c_package AS 
   -- Adds a customer 
   PROCEDURE addCustomer(c_name  customers.custname%type, 
   c_account_no  customers.account_no%type, 
   c_cur_balance customers.cur_balance%type);

   -- Removes a customer 
   PROCEDURE delCustomer(c_account_no  customers.account_no%TYPE); 

   --Lists all customers 
   PROCEDURE listCustomer; 
  
END c_package; 
/

我的包裹体是:
CREATE OR REPLACE PACKAGE BODY c_package AS
   PROCEDURE addCustomer(
   c_name       customers.custname%type, 
   c_account_no     customers.account_no%type, 
   c_cur_balance    customers.cur_balance%type)
   IS 
   BEGIN 
      INSERT INTO customers(custname,account_no,cur_balance) 
      VALUES(c_name, c_account_no, c_cur_balance); 
   END addCustomer;

   PROCEDURE delCustomer(c_account_no   customers.account_no%type)
   IS 
   BEGIN 
      DELETE FROM customers 
      WHERE account_no = c_account_no; 
   END delCustomer;

   PROCEDURE listCustomer IS 
   CURSOR c_customers is 
      SELECT  custname FROM customers; 
   TYPE c_list is TABLE OF customers.custname%type; 
   custname_list c_list := c_list(); 
   counter integer :=0; 
   BEGIN 
      FOR n IN c_customers LOOP 
      counter := counter +1; 
      custname_list.extend; 
      custname_list(counter) := n.custname; 
      dbms_output.put_line('Customer(' ||counter|| ')'||custname_list(counter)); 
      END LOOP; 
   END listCustomer;
END c_package; 
/

我不断收到的错误是:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/19     PLS-00103: Encountered the symbol "." when expecting one of the
         following:
         in out <an identifier> <a double-quoted delimited-identifier>
         table ... columns long double ref char time timestamp
         interval date binary national character nchar
         The symbol "<an identifier>" was substituted for "." to continue.


4/25     PLS-00103: Encountered the symbol "." when expecting one of the
         following:
         in out <an identifier> <a double-quoted delimited-identifier>

LINE/COL ERROR
-------- -----------------------------------------------------------------
         table ... columns long double ref char time timestamp
         interval date binary national character nchar
         The symbol "<an identifier>" was substituted for "." to continue.


5/26     PLS-00103: Encountered the symbol "." when expecting one of the
         following:
         in out <an identifier> <a double-quoted delimited-identifier>
         table ... columns long double ref char time timestamp
         interval date binary national character nchar
         The symbol "<an identifier>" was substituted for "." to continue.

LINE/COL ERROR
-------- -----------------------------------------------------------------


12/47    PLS-00103: Encountered the symbol "." when expecting one of the
         following:
         in out <an identifier> <a double-quoted delimited-identifier>
         table ... columns long double ref char time timestamp
         interval date binary national character nchar
         The symbol "<an identifier>" was substituted for "." to continue.


我不确定它是什么,我认为它可能是某个地方的拼写错误,但我不知道是哪一个,正如我所说,我是 oracle sqlplus 的新手,并且仍在弄清楚,一些帮助将是真正的感谢,谢谢你:)

标签: sqloracleplsqlpackagesqlplus

解决方案


推荐阅读