从oracle查询时出现以下错误:
ORA-06502:PL / SQL:数字或值错误:字符串缓冲区太小 ORA-06512:在第1行
这是我的查询:
with my_clob as ( select ID,SUBJECT,EMAIL_LAYOUT,EMAIL_SENDER_TYPE from BMS_EMAIL_TEMPLATE where ID = 26 ) select ID,SUBJECT,EMAIL_SENDER_TYPE, dbms_lob.substr(EMAIL_LAYOUT, 4000, (level - 1) * 4000 + 1) AS EMAIL_LAYOUT from my_clob connect by level <= ceil(dbms_lob.getlength(EMAIL_LAYOUT) / 4000)
任何人都可以帮助我在这里我想念的东西吗?
答案 0 :(得分:0)
请提供表格BMS_EMAIL_TEMPLATE的描述吗? EMAIL_LAYOUT是克隆还是大型varchar2?
我无法使用以下代码重现您的错误
with bs as (
select to_clob( lpad('x',37,'x')) f1 from dual),
bs1 as (select f1||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 as f1 from bs),
bs2 as (select f1||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 as f1 from bs1),
bs3 as (select f1||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 as f1 from bs2),
cl as ( select f1||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 ||f1 as f1 from bs3),
my_clob AS (
SELECT
26 id,
'subj' subject,
f1 email_layout,
length(f1) email_length,
'est' email_sender_type
FROM
cl
) SELECT
id,
subject,
email_sender_type,
email_length,
dbms_lob.substr(email_layout,4000, (level - 1) * 4000 + 1) AS email_layout
FROM
my_clob
CONNECT BY
level <= ceil(dbms_lob.getlength(email_layout) / 4000);