-
How can do I run the following stored procedure in SQL/PLUS? I need to define a variable for OUT_customer_information_rec, include it in the parameter list and then print it. (I can't find the answer in Feuerstein's book :) )
Code:
create or replace procedure get_customer_info
( IN_customer_nbr IN NUMBER,
OUT_customer_information_rec OUT customer_information%rowtype)
IS
BEGIN
SELECT *
INTO OUT_customer_information_rec
FROM customer_information
WHERE customer_nbr = IN_customer_nbr;
END;
This does NOT work:
Code:
variable c1 customer_inforamtion.rowtype;
exec get_customer_info (123, :c1);
print c1;
-
Do it as part of a PL/SQL block then output the results using DBMS_OUPUT:
SET SERVEROUTPUT ON
DECLARE
v_c1 customer_inforamtion%rowtype
BEGIN
get_customer_info (123, v_c1);
-- Output the data
DBMS_OUTPUT.PUT_LINE('v_c1.col1: ' || v_c1.col1);
DBMS_OUTPUT.PUT_LINE('v_c1.col2: ' || v_c1.col2);
-- etc.
END;
/
Obviously, modify the column names and the numbers of columns accordingly.
Cheers