为什么oracle plsql varchar2 变量需要大小而参数不需要? [英] Why does an oracle plsql varchar2 variable need a size but a parameter does not?

查看:39
本文介绍了为什么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 变量需要大小而参数不需要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆