Reputation: 23
I'm tring to run this code in SQL. It returns identifier not declared patient_t
.i already created patient_t type/object.and also i tried patient_t%rowtype
CREATE OR REPLACE PACKAGE PATIENT_DATA_SERVICES AS
function get_patient_id
( p_first_name in varchar2
, p_last_name in varchar2
) return number
;
function get_patient_record
( p_patient_id in number
) return patient_t
;
END PATIENT_DATA_SERVICES;
Upvotes: 0
Views: 1022
Reputation: 5265
You need to declare the type patient_t
in the PL/SQL package:
CREATE OR REPLACE PACKAGE PATIENT_DATA_SERVICES AS
TYPE patient_t IS RECORD (id NUMBER(15), ...);
function get_patient_id
( p_first_name in varchar2
, p_last_name in varchar2
) return number
;
function get_patient_record
( p_patient_id in number
) return patient_t
;
END PATIENT_DATA_SERVICES;
Should patient_t
be a table in your database, the function can be declared like this:
function get_patient_record (p_patient_id in number) return patient_t%ROWTYPE;
Upvotes: 0
Reputation: 1773
Remove %rowtype. %rowtype is meant for TABLE or CURSOR. patient_t is TYPE as you created.
function get_patient_record
( p_patient_id in number
) return patient_t
;
Upvotes: 1