[#330] Add example Package with RECORD types to the Sakila database
This commit is contained in:
parent
ba70b3ea08
commit
0658eae613
@ -384,4 +384,28 @@ CREATE OR REPLACE PACKAGE BODY RENTALS AS
|
||||
END GET_FILM_INFO;
|
||||
|
||||
END RENTALS;
|
||||
/
|
||||
/
|
||||
|
||||
CREATE PACKAGE customers AS
|
||||
TYPE person IS RECORD (
|
||||
first_name VARCHAR2(50),
|
||||
last_name VARCHAR2(50)
|
||||
);
|
||||
|
||||
FUNCTION get_customer(p_customer_id NUMBER) RETURN person;
|
||||
END customers;
|
||||
/
|
||||
|
||||
CREATE PACKAGE BODY customers AS
|
||||
FUNCTION get_customer(p_customer_id NUMBER) RETURN person IS
|
||||
v_person customers.person;
|
||||
BEGIN
|
||||
SELECT c.first_name, c.last_name
|
||||
INTO v_person
|
||||
FROM customer c
|
||||
WHERE c.customer_id = p_customer_id;
|
||||
|
||||
RETURN v_person;
|
||||
END get_customer;
|
||||
END customers;
|
||||
/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user