Oracle 中 varchar2 PL/SQL 子程序参数的大小限制是多少?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/186403/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the size limit for a varchar2 PL/SQL subprogram argument in Oracle?
提问by Aurelio Martin Massoni
When you create a procedure (or a function) in Oracle PL/SQL, you cannot specify the maximum length of the varchar2 arguments, only the datatype. For example
在 Oracle PL/SQL 中创建过程(或函数)时,不能指定 varchar2 参数的最大长度,只能指定数据类型。例如
create or replace procedure testproc(arg1 in varchar2) is
begin
null;
end;
Do you know the maximum length of a string that you can pass as the arg1 argument to this procedure in Oracle ?
您知道在 Oracle 中可以作为 arg1 参数传递给此过程的字符串的最大长度吗?
回答by Gravstar
In PL/SQL procedure it may be up to 32KB
在 PL/SQL 过程中它可能高达 32KB
Futher information here: http://it.toolbox.com/blogs/oracle-guide/learn-oracle-sql-and-plsql-datatypes-strings-10804
更多信息:http: //it.toolbox.com/blogs/oracle-guide/learn-oracle-sql-and-plsql-datatypes-strings-10804
回答by Aurelio Martin Massoni
I tried with testproc( lpad( ' ', 32767, ' ' ) ) and it works.
我尝试使用 testproc( lpad( ' ', 32767, ' ' ) ) 并且它有效。
With 32768 bytes it fails, so it's 32K - 1 bytes
32768 字节失败,所以它是 32K - 1 字节
回答by user272735
In PL/SQL the maximum size of VARCHAR2
datatype is 32767 bytessince 10gR2 (and probably earlier but I just checked the documentation upto that release).
在 PL/SQL 中,自 10gR2 以来VARCHAR2
数据类型的最大大小为32767 字节(可能更早,但我只是检查了该版本之前的文档)。
The documentation references:
文档参考:
- Oracle 12cR1: PL/SQL Language Reference 12c Release 1
- Oracle 11gR2: PL/SQL Language Reference 11g Release 2
- Oracle 10gR2: PL/SQL User's Guide and Reference 10g Release 2
- Oracle 12cR1:PL/SQL 语言参考 12c 第 1 版
- Oracle 11gR2:PL/SQL 语言参考 11g 第 2 版
- Oracle 10gR2:PL/SQL 用户指南和参考 10g 第 2 版