In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use the DETERMINISTIC function", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use the DETERMINISTIC function" bar!
I defined the following functions:
FUNCTION plch_getdata (n NUMBER) RETURN NUMBERISBEGIN RETURN nterend
Which options include code that will improve performance if I add the above function to the DETERMINISTIC keyword?
Two points should be noted:
1. In one of the options, this function is "redefined" as an embedded subroutine.
two。 Two of these options contain queries executed in ALL_SOURCE, and you can assume that there are more than 1000000 lines of code in this view.
(A)
DECLARE n NUMBER;BEGIN FOR rec IN (SELECT plch_getdata (1) n FROM all_source WHERE ROWNUM < 1000000) LOOP n: = rec.n; END LOOP;END;/
(B)
DECLARE n NUMBER;BEGIN FOR indx IN 1.. 10000000 LOOP n: = plch_getdata (1); END LOOP;END;/
(C)
DECLARE n NUMBER; FUNCTION plch_getdata (n NUMBER) RETURN NUMBER DETERMINISTIC IS BEGIN RETURN n; END;BEGIN FOR indx IN 1.. 10000000 LOOP n: = plch_getdata (1); END LOOP;END;/
(D)
DECLARE n NUMBER;BEGIN FOR rec IN (SELECT plch_getdata (ROWNUM) n FROM all_source WHERE ROWNUM < 1000000) LOOP n: = rec.n; END LOOP;END;/
Answer AB.
Both An and B repeatedly call the same function and use the same parameters. With the addition of deterministic, the result of the function is cached and only called once.
C: syntax error, deterministic cannot be used in nested subroutines.
D: the parameters change each time and cannot be cached.
Thank you for your reading, the above is the content of "how to use the DETERMINISTIC function", after the study of this article, I believe you have a deeper understanding of how to use the DETERMINISTIC function, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.