我有一个参数化(动态)查询,我想在 oracle 过程中重用(如果可能的话,甚至在 oracle 包中),如下所示:
cursor q (p1 integer, p2 integer, p3 ...) as
select .... from .... where col1 = p1 and col2 = p2 and ....
然后在后续查询中执行类似的操作
select ...
from t1, t2, ..., q (a, b, c)
where q.c1 = t1.tc1
and q.c2 = t2.tc2
....
select ...
from n1, n2, ..., q (a, b, c)
where q.c1 = n1.tc1
and q.c2 = n2.tc2
....
如果查询是静态的,我已经使用了 VIEWS 但它不是.. 还有其他更简单的方法而不是填充和使用大量额外的对象吗?