使用list_agg

时间:2015-11-21 04:09:57

标签: arrays json sys-refcursor

任何人都可以告诉我如何在存储过程中使用list_agg从sys_refcusrosr构造json吗?我得到错误结果"字符串连接太长"当我这样做的时候?

创建或替换程序员工(                p_employee_num IN NUMBER,                p_next_level IN NUMBER,                p_record_out OUT SYS_REFCURSOR)

如 开始 打开p_record_out WITH employee_details          as(选择' {' ||'"员工父母姓名"'                  || employee_parent_level                      || '",'                              || '"员工孩子姓名"'                  || employee_child_level                              || '},'                            JSON           从           雇员           从employee_child_level = p_employee_num开始                   先前employee_child_level = employee_parent_level连接           和水平< (1 + p_next_level)                   按级别排序)     选择' {"公司" :['                 ||(选择listagg(json,',')                         在组内(按1排序)                     来自employee_details                     )                 ||']}'             来自双重;
最终员工;

0 个答案:

没有答案