Created
February 11, 2021 09:01
-
-
Save Jordan-Lloyd-GW/dc067bd6eeca3b6897aea8bfaf1142e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Create table | |
CREATE TABLE tb_date_test ( | |
date_id NUMBER GENERATED ALWAYS AS IDENTITY, | |
my_date DATE | |
); | |
--Create object | |
CREATE TYPE o_date_test AS OBJECT ( | |
date_id NUMBER, | |
my_date DATE | |
); | |
CREATE OR REPLACE PROCEDURE pr_date_test(p_in_date IN DATE, p_out_date OUT o_date_test) | |
IS | |
tmp INTEGER; | |
l_out_date o_date_test; | |
BEGIN | |
INSERT INTO tb_date_test(my_date) values(p_in_date) RETURNING date_id INTO tmp; | |
SELECT o_date_test(date_id, my_date) INTO l_out_date FROM tb_date_test WHERE date_id = tmp; | |
p_out_date := l_out_date; | |
END; | |
DECLARE | |
l_out_date o_date_test; | |
BEGIN | |
pr_date_test(sysdate, l_out_date); | |
DBMS_OUTPUT.PUT_LINE('l_out_date.id: ' || l_out_date.date_id || ', ' || 'l_out_date.date: ' || l_out_date.my_date); | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment