[英]Oracle pipelined function with cache
如何在查询中使用oracle pipelined函数才能第一次获取数据。
例:
create or replace function best_employees return my_type pipelined;
select * from employees a
join table(best_employees) b
on a.employee_id = b.employee_id;
这个查询多次调用best_employees函数。 它必须只是第一次打电话。 我怎样才能做到这一点。 谢谢。
虽然您可以将结果存储在my_type
类型的包集合中,但是如果函数包含值而不是重新执行查询,则将函数写入返回,更简单,更可靠的方法是在查询中使用result_cache
提示。
select /*+ result_cache */ kitten_id, cuteness from kittens where colour = 'BLACK';
( 函数还有一个result_cache
选项,但它不能用于流水线函数。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.