我在 Oracle ORDS 中创建了一个 Rest API,我需要返回一个大于 32k 的 base64 文本。源类型是 PL/SQL。
原始数据在 CLOB 变量中,但 ORDS 不支持这种返回。我尝试使用 LONG,但当它大于 32k 时,我无法将字符串移动到 LONG。
- 我试图将内容从 CLOB 移动到 LONG,但没有成功。
- 我尝试使用我需要的文本创建两个 Long 变量,并将其连接到 Long 变量以输出它,但也没有成功。
- 我能够在 ResultSet 中返回内容,但它会使 Json 结构与我需要的不同。
--This is the variable that has the large text (about 40k characters)
out_hexa CLOB;
-- :boleto 是 ORDS 中的 OUT 参数 (OUT, RESPONSE, LONG)
--This wont work:
:boleto := out_hexa;
--This wont work:
:boleto := substr(out_hexa, 1, 32765) || substr(out_hexa, 32765, LENGTH(out_hexa));
--这可行,但 Json 输出不是我想要的方式,因为它在 Json Importante 中创建了第二个级别:在这种情况下,:boleto 是 ResultSet,而不是 Long
OPEN :boleto FOR
SELECT out_hexa as dados from dual;
In this case the output is:
{
"boleto": [
{
"dados": "JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7..."
}
]
}
What I need is a Json in this format:
{
"boleto": "JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7..."
}