In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to judge the density of database collections". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I created this utility function to display the value of a Boolean variable:
CREATE OR REPLACE PROCEDURE plch_bpl (val IN BOOLEAN) ISBEGIN DBMS_OUTPUT.put_line (CASEval WHEN TRUE THEN 'TRUE' WHEN FALSE THEN' FALSE' ELSE 'NULL' END); END plch_bpl;/
The following options contain the following implementation code for this function:
CREATE OR REPLACE FUNCTION plch_is_dense (numbers_in IN DBMS_SQL.number_table) RETURN BOOLEAN
I wrote another helper procedure to test the plch_is_dense function:
CREATE OR REPLACE PROCEDURE plch_test_is_denseIS l_numbers DBMS_SQL.number_table;BEGIN l_numbers (1000): = 1; l_numbers (3000): = 1; plch_bpl (plch_is_dense (l_numbers)); l_numbers (2): = 1; l_numbers (3): = 1; plch_bpl (plch_is_dense (l_numbers)); END;/
Which options create a plch_is_dense that causes plch_test_is_dense to display these two lines of text after execution?
FALSETRUE
(A)
ISBEGIN RETURN numbers_in.COUNT = (numbers_in.LAST-numbers_in.FIRST); END
(B)
IS l_number NUMBER;BEGIN FOR indx IN numbers_in.FIRST.. Numbers_in.LAST LOOP l_number: = numbers_in (indx); END LOOP; RETURN TRUE;EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE;END
(C)
IS l_number NUMBER;BEGIN FOR indx IN 1.. Numbers_in.COUNT LOOP l_number: = numbers_in (indx); END LOOP; RETURN TRUE;EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE;END
(D)
ISBEGIN RETURN numbers_in.COUNT = (numbers_in.LAST-numbers_in.FIRST + 1); END
The running result is as follows
(A)
CREATE OR REPLACE FUNCTION plch_is_dense (numbers_in IN DBMS_SQL.number_table) RETURN BOOLEAN ISBEGIN RETURN numbers_in.COUNT = (numbers_in.LAST-numbers_in.FIRST); END;/SQL > exec plch_test_is_dense;FALSEFALSEPL/SQL procedure successfully completedSQL >
(B)
CREATE OR REPLACE FUNCTION plch_is_dense (numbers_in IN DBMS_SQL.number_table) RETURN BOOLEAN IS l_number NUMBER;BEGIN FOR indx IN numbers_in.FIRST.. Numbers_in.LAST LOOP l_number: = numbers_in (indx); END LOOP; RETURN TRUE;EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE;END;/SQL > exec plch_test_is_dense;FALSETRUEPL/SQL procedure successfully completedSQL >
(C)
CREATE OR REPLACE FUNCTION plch_is_dense (numbers_in IN DBMS_SQL.number_table) RETURN BOOLEAN IS l_number NUMBER;BEGIN FOR indx IN 1.. Numbers_in.COUNT LOOP l_number: = numbers_in (indx); END LOOP; RETURN TRUE;EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE;END;/SQL > exec plch_test_is_dense;FALSEFALSEPL/SQL procedure successfully completedSQL >
(D)
CREATE OR REPLACE FUNCTION plch_is_dense (numbers_in IN DBMS_SQL.number_table) RETURN BOOLEAN ISBEGIN RETURN numbers_in.COUNT = (numbers_in.LAST-numbers_in.FIRST + 1); END;/SQL > exec plch_test_is_dense;FALSETRUEPL/SQL procedure successfully completedSQL > 10-31 answer BD. For non-intensive COLLECTION access, you can't start with 1, but use the FIRST method. Accessing elements that do not exist will throw a NO_DATA_FOUND exception. "how to determine the density of database collections" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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: 287
*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.