PL/SQL:数字或值错误:字符串缓冲区太小%ROWTYPE [英] PL/SQL: numeric or value error: character string buffer too small %ROWTYPE

查看:131
本文介绍了PL/SQL:数字或值错误:字符串缓冲区太小%ROWTYPE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否缺少什么,但是我正在做的是:

I don't know if I am missing something but what I am doing is:

我有一个返回ROWTYPE的函数

I have a function that returns a ROWTYPE

  FUNCTION myFunc(pChar CHAR) RETURN myTable%ROWTYPE AS
    myTable_rec myTable%ROWTYPE;
  BEGIN
    SELECT col1, col2, col3
    INTO myTable_rec.col1 
      , myTable_rec.col2
      , myTable_rec.col3
    FROM myTable
    WHERE col4 = pChar;

    RETURN(myTable_rec);
  END B001_03;

然后在我的过程(调用上面的函数)中,我声明:

then in my procedure (which calls the function above), I declared:

myTable_rec myTable%ROWTYPE;

但是当我在程序中调用时:

but when I call in the procedure:

...
myTable_rec := myFunc(someChar);
...

我知道

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

这些字段不是应该来自同一表和OF THE SAME数据类型吗(据我所知)?

Aren't the fields supposed to be FROM the same table and OF THE SAME datatype (as of my little understanding)?

我试图选择*和所有的作品.我肯定在这里错过了一些东西.我只是不知道那是什么.

I tried to SELECT * and every works. I am definitely missing something here. I just don't know that it is.

推荐答案

我敢打赌,问题出在使用固定长度字符串Char.不知道在哪里,但是您尝试在代码中的某个地方尝试将长度为N的Char或varchar2字符串放入长度为M的字符char中,其中M> N.

I bet the problem originates from using Char which is a fixed length string. Not sure where, but somewhere in your code you try to put a Char or varchar2 string of length N into a char of lengh M where M > N.

这篇关于PL/SQL:数字或值错误:字符串缓冲区太小%ROWTYPE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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