我有这个查询
Select distinct a.name,
p1.ref as book,
p2.ref as text,
p3.ref as note
from library a
left join room p1 on a.id=p1.id
left join room p2 on a.id=p2.id
left join room p3 on a.id=p3.id
我开始创建如下功能。函数的输出需要是上面的查询。 p1,p2和p3是动态生成的
rlsql varchar2(12000) := 'select distinct ';
rlsql := rlsql||'ref as '||c_var.name||',';
rlsql := rlsql||chr(13)||chr(10);
rlsql := rlsql||' from library';
rlsql := rlsql||' left join room on a.id='||c_var.id||'
当我执行上述部分功能时,它返回我作为下面的示例
Select distinct
ref as book from library,
ref as text from library,
ref as note from library
如何删除每行上的“from library”以及如何获取p1。 ,P2。 ,P3。动态
对此有任何帮助表示高度赞赏
答案 0 :(得分:0)
删除这一行连接' from library'
rlsql := rlsql||' from library';