Oracle 存储过程的 varchar2 输入的默认大小是多少,是否可以更改?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4675417/
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 default size of a varchar2 input to Oracle stored procedure, and can it be changed?
提问by Gern Blanston
I have a stored procedure in Oracle Database 10g where my input is a varchar2 but I'm having issues getting it to run when the input string is long (not sure of exact length maybe > 8000).
我在 Oracle 数据库 10g 中有一个存储过程,其中我的输入是 varchar2,但是当输入字符串很长(不确定确切长度可能 > 8000)时,我在让它运行时遇到问题。
My thought is the 'intext varchar2' (as below) is by default is too small. In other cases where I need a longer string I might define a varchar2 as "intext2 VARCHAR2(32767);" I tried to define the size similarly in the code below but my syntax is incorrect.
我的想法是默认情况下“intext varchar2”(如下所示)太小了。在其他需要更长字符串的情况下,我可能会将 varchar2 定义为“intext2 VARCHAR2(32767);” 我试图在下面的代码中类似地定义大小,但我的语法不正确。
create or replace PROCEDURE TESTPROC ( intext IN VARCHAR2
) AS ....
What is the (default) size of the intext varchar2?
intext varchar2 的(默认)大小是多少?
Can that size be defined (increased)?
可以定义(增加)该大小吗?
thanks
谢谢
回答by Justin Cave
You cannot specify a size for a VARCHAR2 parameter to a procedure.
不能为过程的 VARCHAR2 参数指定大小。
The procedure should happily accept strings up to 32k in size (the maximum size of a VARCHAR2 in PL/SQL). If it were a function that was being called from SQL rather than PL/SQL, the limit would be 4k because the maximum size of a VARCHAR2 in SQL is only 4k.
该过程应该很乐意接受最大为 32k 的字符串(PL/SQL 中 VARCHAR2 的最大大小)。如果它是从 SQL 而不是 PL/SQL 调用的函数,则限制为 4k,因为 SQL 中 VARCHAR2 的最大大小仅为 4k。