Java コードからget_data_Q1
パッケージ内のこのプロシージャを呼び出して、出力を表示したいと考えています。ult_pkg
CREATE OR REPLACE PACKAGE ult_pkg
AS
TYPE t_all_record is record (
x_object_type_id number,
x_object_name varchar2(100),
x_object_id varchar2(70),
x_audit_timestamp timestamp(6),
x_payload clob
);
--table type to hold table data after querying
type tt_all_tab is table of t_all_record index by binary_integer;
--declaration pocedures
procedure get_data_Q1(x_object_id in varchar2 , x_all_type out tt_all_tab );
end ult_pkg;
/
--body of 'ult_pkg' package
create or replace package body ult_pkg
AS
--procedure taking 'object_id' as input parameter and gives out table of 't_all_record' type
procedure get_data_Q1(x_object_id in varchar2 , x_all_type out tt_all_tab )
AS
i number:=0;
begin
for r in
(
SELECT
O.object_type_id,O.object_name,O.object_id,A.audit_timestamp,P.payload
FROM
APPLICATION APP, EXCEPTIONS E,MASTER_AUDIT A,MODULE_TYPE M,OBJECT_TYPE O,PAYLOAD P
WHERE
( A.MODULE_TYPE_ID = M.MODULE_TYPE_ID ) AND ( M.APPLICATION_ID = APP.APPLICATION_ID ) AND ( A.OBJECT_TYPE_ID = O.OBJECT_TYPE_ID ) AND ( O.OBJECT_ID = x_object_id )
)
-- loop to asign the data from cursor 'r' to carasponding table type columns
loop
x_all_type(i).x_object_type_id:=r.object_type_id;
x_all_type(i).x_object_name:=r.object_name;
x_all_type(i).x_object_id:=r.object_id;
x_all_type(i).x_audit_timestamp:=r.audit_timestamp;
x_all_type(i).x_payload:=r.payload;
i:=i+1;
end loop;
end get_data_Q1;
end ult_pkg;
/