Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. In your own words, describe parameters and the purpose they serve in PL/SQL subprograms. 2. Using the COUNTRIES table: A. Create a procedure that
1. In your own words, describe parameters and the purpose they serve in PL/SQL subprograms. 2. Using the COUNTRIES table: A. Create a procedure that accepts a country_id as a parameter and displays the name of the country and its capitol city. Name your procedure get_country_info. Save your procedure definition for later use. B. Execute your procedure from an anonymous block, using country_id 90 . C. Re-execute the procedure from the anonymous block, this time using country_id 95. What happens? D. Retrieve your procedure code from Saved SQL and modify it to trap the NO_DATA_FOUND exception in an exception handler. Execute the modified procedure using country_ id 95 again. Now what happens? 3. In your own words, describe what a formal parameter is and what an actual parameter is. Also, name three variations for an actual parameter. Copyright e 2020, Oracle andior its aftliabs. As rights reserved. Oracle and Java are registered trademarks of Oracle andior its aftliates. Other names moy be trademarks of their respective owners 4. Procedure Exercise: A. Write a procedure that displays the number of countries in a given region whose highest elevations exceed a given value. The procedure should accept two formal parameters, one for a region_id and the other for an elevation value for comparison. Use DBMS_OUTPUT.PUT_LINE to display the results in a message. Save your procedure code. B. Execute your procedure using the value 5 for the region_id and 2000 for the highest elevation. C. DESCRIBE your procedure to check the names and datatypes of its formal parameters. D. Retrieve your procedure code from Saved SQL and modify it to accept a third formal parameter of datatype CHAR. The procedure should display a count of the number of countries in a given region whose highest elevations exceed a given value and whose country name starts with a given alphabetic character. Your SELECT statement should include a WHERE condition to compare the first character of each country's name with the third parameter value (Hint: use SUBSTR). Save your work again and DESCRIBE the modified procedure. E. Write an anonymous block which declares three variables to store actual parameter values for the region_id, elevation, and area, and then executes the procedure passing these values. Execute the block using values 5,2000 , and ' B '. F. Modify your anonymous block to use the same actual parameter values but pass them to the procedure in a different order: (5, ' B ', 2000). Execute the block. What happens and why
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started