簡體   English   中英

帶有緩存的Oracle流水線功能

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

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM