syntax error when declaring variables in a pl/sql procedure(在 pl/sql 过程中声明变量时出现语法错误)
问题描述
这让我有点生气.我正在尝试向过程中添加一个变量,但它不起作用 - 我刚刚收到此错误消息:
This is sending me a bit mad. I'm trying to add in a variable to a procedure, but it wasn't working - I just got this error message:
[Error] 语法检查 (25: 7): ERROR line 25, col 7,ending_line 25,Ending_col 12,找到数字",期待:;- 或 - .. := 默认NOT NULL -or- % -or- ( . @
[Error] Syntax check (25: 7): ERROR line 25, col 7, ending_line 25, ending_col 12, Found 'number', Expecting: ; -or- .. := DEFAULT NOT NULL -or- % -or- ( . @
我在下面编写了一个非常基本的程序来隔离问题,现在我完全卡住了,因为我看过的每个基本语法指南都说要做我所做的.为什么我不能声明如下所示的变量?如果这对我的问题有任何线索,我通常会在 SQL Server 中进行编码.如果有人能帮忙,非常感谢!
I knocked up a really basic procedure below to isolate the problem and now I'm completely stuck, as every basic syntax guide I've looked as says to do what I've done. Why can't i declare variables as shown below? I normally code in SQL Server if that's any clue as to my problem. Many thanks if anyone can help!
CREATE OR REPLACE PROCEDURE MRCS.pro_xxx_test1 (cats out sys_refcursor)
IS
declare
spoon number;
balls varchar2(3);
BEGIN
open cats for select * from dual;
end;
/
推荐答案
删除DECLARE".在函数/过程声明中不需要
Remove the "DECLARE". Not needed in a function / procedure declaration
这篇关于在 pl/sql 过程中声明变量时出现语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 pl/sql 过程中声明变量时出现语法错误


基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01