我有一个程序会出现错误“PL/SQL:语句被忽略”。此消息有点模糊,我无法弄清楚为什么我的程序无法编译。所有程序应该做的是检查客户的交货日期是否小于 SYSDATE,如果它被删除,如果没有打印'客户不能被删除'。
该过程的代码在这里:
CREATE PROCEDURE remove_customer (customer_id VARCHAR2) IS
declare
ordersCount pls_integer;
BEGIN
select count(*) into ordersCount
from placed_orders
where fk1_customer_id = remove_customer.customer_id
and delivery_date < sysdate;
if ordersCount = 0 then
THEN
DELETE FROM order_line
WHERE order_line.FK1_order_id in
(SELECT order_id FROM placed_order
WHERE placed_order.FK1_customer_id = remove_customer.customer_id
);
DELETE FROM placed_order
WHERE placed_order.FK1_customer_id = remove_customer.customer_id;
DELETE FROM customer
WHERE customer.customer_id = remove_customer.customer_id;
total_customers := total_customers - 1;
ELSE
DBMS_OUTPUT.PUT_LINE 'Customer currently has a order been delivered';
END IF;
END;
并且错误消息指定 PLS-00103:遇到符号“DECLARE”
感谢您的任何建议。