- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个程序会出现错误“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”
感谢您的任何建议。
最佳答案
这一行:
IF placed_order.delivery_date < SYSDATE
没有多大意义 - 您不能使用这样的列(想一想:placed_order 中的哪些行应该与 SYSDATE 进行比较?一个?全部?)。
如果你想检查这个客户是否有已经交付的 cargo ,你需要一个额外的 SELECT:
CREATE PROCEDURE remove_customer (customer_id VARCHAR2) IS
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
-- your code for deleting the customer here
else
-- raise error, show message, ...
end if;
关于sql - 错误 PLS-00103 : Encountered the symbol "DECLARE"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16459565/
我构建了一个自定义的 EST(指数平滑)模型。首先,我定义了一个函数,其中包含传递给第二个函数的参数定义,该函数执行计算并返回预测错误。然后将这些平方并求和。然后,最小化器应优化参数,以便最小化平方误
无法解析模板“ASClass”错误信息: This template did not produce a Java class or an interface package com.example.
我正在尝试将我的井字游戏结果输出到数据库。但是,每当两个客户端之间的匹配完成时,我都会遇到此错误。这是我的服务器端代码和错误消息的摘录: 数据库类: import java.sql.*;
我想创建一个过程来检查记录是否存在,然后更新,否则插入。但是,有一个问题我试图解决,但无法解决。请帮助。 CREATE TABLE JOB_RUN ( DATE_KEY VARCHAR2(8), JO
这是我第一次在 derby 查询中创建存储过程。我正在尝试创建一个程序。当我尝试运行查询时,出现错误 Encountered "BEGIN" 代码 CREATE PROCEDURE show_name
当我运行 pyOpenTld 时,我得到 RuntimeWarning: overflow encountered in int_scalars从这个模块。为什么会这样? Warning (from
昨晚将一个disucz论坛进行转移后,发现打开的页面上回多一个PHP has encountered a Stack overflow 这个提示错误,进过翻译为“PHP遇到堆栈溢出”。我就感觉奇怪了
我是机器学习和 numpy 的新手,我一直在尝试在来自 sklearn 的波士顿住房数据集上运行梯度下降我的实现适用于小型随机数据集,但在波士顿数据集中它会产生这些警告 :12: RuntimeWar
我正在尝试在 Windows Server 2008 上使用 TortoiseSVN checkout SVN 存储库。我在 checkout 时收到错误消息“遇到不正确的参数”,仅此而已。知道这里可
我正在尝试使用 Parsec 在 Haskell 中编写解析器。目前我有一个可以解析的程序 test x [1,2,3] end 执行此操作的代码如下 testParser = do { rese
这个问题已经有答案了: Android 8: Cleartext HTTP traffic not permitted (37 个回答) 已关闭 3 年前。 我正在 Android Studio 上构
我在 angular.js 中定义了一个空模块: angular.module('todoList', [], function () { }) 然后我想在我的 conf.js 中测试它,我加载这些j
当使用OpenJPA在内存数据库org.apache.derby中执行select语句时,遇到以下错误: javax.ejb.EJBException: The bean encountered a
我需要开始处理外来字符,在这样做的过程中,我想我真的搞砸了文件的编码。 我得到的错误是: Lexical error at line 1, column 8. Encountered: "" (0)
我试图在 Python 中创建一个 sigmoid 函数,但是,我收到以下错误: RuntimeWarning: overflow encountered in exp 这是我的代码: def sig
我有三个耦合的常微分方程,我在 python 中使用 RK4 方法在给定的初始条件下求解它们。当我运行它们时,我收到以下错误: RuntimeWarning: overflow encountered
我是 Hadoop 和 Pig 的初学者。我检查了在cloudera虚拟镜像中证明的例子,并对其进行了修改以计算前5个常用词: Lines = LOAD '/user/hue/pig/examples
我是 Python 的新手,这是我编写脚本的第一件事,我只是想知道我能做些什么来删除这个警告: Warning (from warnings module): File "C:\Users\Lur
我正在编写一个 UNIX paste 克隆。然而,我不断收到“遇到断点”消息,但 VS 不会告诉我发生在哪一行。 #include #include #define INITALLOC 16
无论我是在 Visual Studio 2017 中同步还是只是使用 Git Bash 进行推送,我都会不断收到此错误。看起来 PUSH/PULL 命令有效,但我仍然看到此错误并希望它消失。 我的 W
我是一名优秀的程序员,十分优秀!