Given the lack of a response so far, the following should help:
create or replace type person_type as object (
last_name varchar2(30),
middle_name varchar2(30),
first_name varchar2(30)
);
create or replace procedure display_person (pPerson in person_type)
as
begin
dbms_output.enable;
– Has a person been defined?
if (pPerson is null) then
dbms_output.put_line(‘A mystery person has been passed. I cannot cope with this!’);
dbms_output.put_line(’ ');
return;
end if;
– We have a person. Display the details.
dbms_output.put_line(‘First Name:’ || pPerson.first_name);
dbms_output.put_line(‘Middle Name:’ || pPerson.middle_name);
dbms_output.put_line(‘Last Name:’ || pPerson.last_name);
dbms_output.put_line(’ ');
end;
declare
you person_type; – You are a null person!
me person_type; – I am a real person!
other person_type; – Other, is a real person, with no details.
begin
me := person_type(‘Dunbar’,’[TeamT]’, ‘Norm’);
other := person_type(null, null, null);
display_person(pPerson => you);
display_person (pPerson => me);
display_person (pPerson => other);
end;
Execute the above in Toad, and the following will result:
A mystery person has been passed. I cannot cope with this!
First Name:Norm
Middle Name:[TeamT]
Last Name:Dunbar
First Name:
Middle Name:
Last Name:
HTH
Cheers,
Norm. [TeamT]