In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Http://www.itpub.net/thread-1499223-5-1.html
46th floor
I wrote this stored procedure on Monday:
CREATE OR REPLACE PROCEDURE plch_show_amounts (amount1_in IN NUMBER, amount2_in IN NUMBER) ISBEGIN DBMS_OUTPUT.put_line (TO_CHAR (plch_show_amounts.amount1_in, 'FML999G999D99')); DBMS_OUTPUT.put_line (TO_CHAR (plch_show_amounts.amount2_in,' FML999G999D99')); END;/
On Tuesday, a colleague of mine thought he knew better than anyone how to write good code, criticizing the repetitive code that occurred in the process. "Why don't you put the repeated code in a nested subprocess? that way, if you need to change the display format, or anything else related to the display amount, you only need to change one place."
Well, I can't object either. So I moved the code into a nested subprocess. In fact, I did this several times before I released a working version of the program.
Which of the following options contains a "refactoring" of the original plch_show_amounts, after I execute this code:
BEGIN plch_show_amounts (100.45, 452666.77); END;/
I will see this output on the screen:
$100.45 $452666.77
(A)
CREATE OR REPLACE PROCEDURE plch_show_amounts (amount1_in IN NUMBER, amount2_in IN NUMBER) IS PROCEDURE show_one (amount_in IN NUMBER) AS BEGIN DBMS_OUTPUT.put_line (TO_CHAR (amount1_in, 'FML999G999D99')); END;BEGIN show_one (plch_show_amounts.amount1_in); show_one (plch_show_amounts.amount2_in); END;/SQL > BEGIN 2 plch_show_amounts (100.45, 452666.77) 3 END; 4 / ¥100.45 100.45PL/SQL procedure successfully completedSQL >
(B)
CREATE OR REPLACE PROCEDURE plch_show_amounts (amount1_in IN NUMBER, amount2_in IN NUMBER) IS PROCEDURE show_one (amount_in IN NUMBER) AS BEGIN DBMS_OUTPUT.put_line (TO_CHAR (amount_in, 'FML999G999D99')); END;BEGIN show_one (plch_show_amounts.amount1_in); show_one (plch_show_amounts.amount2_in); END;/SQL > BEGIN 2 plch_show_amounts (100.45, 452666.77) 3 END; 4 / ¥100.45 452666.77PL/SQL procedure successfully completedSQL >
(C)
CREATE OR REPLACE PROCEDURE plch_show_amounts (amount1_in IN NUMBER, amount2_in IN NUMBER) IS PROCEDURE show_one (amount1_in IN NUMBER) AS BEGIN DBMS_OUTPUT.put_line (TO_CHAR (amount1_in, 'FML999G999D99')); END;BEGIN show_one (plch_show_amounts.amount1_in); show_one (plch_show_amounts.amount2_in); END;/SQL > BEGIN 2 plch_show_amounts (100.45, 452666.77) 3 END; 4 / ¥100.45 452666.77PL/SQL procedure successfully completedSQL >
(D)
CREATE OR REPLACE PROCEDURE plch_show_amounts (amount1_in IN NUMBER, amount2_in IN NUMBER) IS PROCEDURE show_one (amount1_in IN NUMBER) AS BEGIN DBMS_OUTPUT.put_line (TO_CHAR (plch_show_amounts.amount1_in, 'FML999G999D99')); END;BEGIN show_one (plch_show_amounts.amount1_in); show_one (plch_show_amounts.amount2_in); END / SQL > BEGIN 2 plch_show_amounts (100.45, 452666.77); 3 END; 4 / ¥100.45 100.45PL/SQL procedure successfully completedSQL >
Answer BC
52nd floor of http://www.itpub.net/thread-1499223-6-1.html
Steven recommends that you carefully review the references to global variables and your own parameters in the embedded subprocess. In many cases, it is best to move the embedded subprocedures out to facilitate code sharing and debugging.
Make up the knowledge points.
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.