我有一个plsql过程,它给出了一个表类型输出.我需要得到json格式的所有行使用一个选择语句,但它返回null.<



这是我尝试过的。我有一个提供表类型输出的plsql过程。因此,我创建了一个plsql函数来调用该过程并将输出转换为包含json格式的表行的clob(也尝试过VARCHAR2)。我使用plsql脚本测试了函数,它正在返回预期的结果,但是当我试图使用选择语句调用函数时,我每次都得到一个空值。请帮助。

过程签名类似procedure(p1 IN, p2 IN, ..., x OUT table)函数类似于

func(p1 IN, p2 IN, ... ) return CLOB 
AS res CLOB;
t table;
BEGIN
proc(p1, p2,....,t)
FOR cursor1 IN (SELECT * FROM TABLE(CAST(t AS table)))
LOOP

res := res || '{ ' || 
'"column1" : ' || '"' || cursor1.column1 || '"' || ',' ||
'"column2" : ' || '"' || cursor1.column2 || '"' || ',' ||
'"column3" : ' || '"' || cursor1.column3 || '"' || ',' ||
'"column4" : ' || '"' || cursor1.column4 || '"' || ',' ||
'}' || ',';               

END LOOP;
return res;
END

你试过oracle的json对象吗?

相关内容

最新更新