[英]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.