sql - 我的包裹体有什么问题??甲骨文 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 的新手,并且仍在弄清楚,一些帮助将是真正的感谢,谢谢你:)
解决方案
推荐阅读
- python - 代码行运行后不显示标题格式
- amazon-web-services - 插槽类型适用于插槽 AWS LEX
- c - 带有指针的运行时检查失败 #2
- c++ - 可以在头文件中保留简单的 C++ 方法定义吗?
- lua - 带有本地链接擦除的 Lua 全局表
- python - 继续运行 Python 代码,但是 CSV 单元格的值为 null
- powerbi - 有没有更好的方法在 Power Bi 的条形图上绘制数据?
- azure - 嵌套组内的所有权和继承
- python - 如何在 JSON 文件中写入字典列表
- excel - 用另一个工作簿中的 Range 填充 SeriesCollection