ORA-06502:PL / SQL:批量将同一列收集到其声明的类型中时出现数字或值错误

时间:2019-07-09 10:28:39

标签: plsql

我声明了一个类型为:-

的表
    TYPE LIST_OF_MASTER
    IS
    TABLE OF SUBS_INFO.MASTER%type;
    I_MASTERS LIST_OF_MASTER;

然后我执行此查询并收到错误ORA-06502:-

    query1 := 'Select master from subs_info where region = ''' || INPUT_REGION || ''';
    EXECUTE immediate (query1) bulk collect INTO I_MASTERS;

SUBS_INFO.MASTER的数据类型为varchar2(35 BYTE)

谢谢。

1 个答案:

答案 0 :(得分:0)

您需要在末尾加上4个单引号:

query1 := 'Select master from subs_info where region = ''' || INPUT_REGION || '''';

看看我的示例 db <>小提琴here