Why does an oracle plsql varchar2 variable need a size but a parameter does not?(为什么oracle plsql varchar2 变量需要大小而参数不需要?)
问题描述
假设你有这个程序:
PROCEDURE f (param VARCHAR2)
IS
var VARCHAR2(10);
BEGIN
var := 'hi';
END f;
我想了解为什么 var
需要指定长度,而 param
不需要.我很难在 oracle 文档中找到相关信息.
I would like to understand why var
needs a length specified, but param
does not. I'm having a hard time finding information about this in the oracle docs.
推荐答案
Oracle 数据库从调用过程的环境中导出参数的长度、精度和小数位数."
"Oracle Database derives the length, precision, and scale of an argument from the environment from which the procedure is called."
请查看此相关问题.
参考:Oracle® 数据库 SQL 参考 10g 第 2 版(10.2)请查看语义/参数/数据类型.
Reference: Oracle® Database SQL Reference 10g Release 2 (10.2) Please look under semantics / argument / datatype.
这篇关于为什么oracle plsql varchar2 变量需要大小而参数不需要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么oracle plsql varchar2 变量需要大小而参数不需要?


基础教程推荐
- 从字符串 TSQL 中获取数字 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01