atgc的博客
===========================================================
Oracle Bug 4458790 06502: PL/SQL: numeric or value error: character string buffer too small
===========================================================
Oralce的一些版本,当在函数里执行了min/max操作,并且这个min/MAX的参数是一个char型的字段

将出错,这是一个BUG
,BUG号Bug 4458790

我测试了win的9.2.0.7没有问题,但是10.2.0.1由问题


SQL
> select * from v$version;


BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL
/SQL Release 10.2.0.1.0 - Production

CORE 10.2.0.1.0 Production

TNS
for 32-bit Windows: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0
- Production



5 rows selected
.




SQL> create table test(name char(5));


Table created.


SQL> insert into test values('a');


1 row created.


SQL> commit;


Commit complete.


SQL> create or replace function myf (p in varchar2) return char

2 is

3 v_1 char
;

4 begin

5 select min
(name) into v_1 from test;

6 return(v_1);

7 end myf;

8 /



Function
created.


SQL> select myf('a') from dual;
select myf('a') from dual

*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small

ORA
-06512: at "A.MYF", line 5



解决方案



将表字段由char为varchar2型



drop table test
;
create table test(name varchar2(5));
insert into test values('A');


SQL> select myf('a') from dual;


MYF('A')

---------------------------------
A



1 row selected
.
atgc 发表于:2007.08.30 19:09 ::分类: ( 技术文章 ) ::阅读:(657次) :: 评论 (0)

发表评论
标题

在此添加评论
表情符号: smile laughing tongue angry crying sad wassat wink

称呼

邮箱地址(可选)

个人主页(可选)




切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
网站链接...