I want to write a function that returns a record which is defined inside it. WHen I compile, the error shown is
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PL/SQL: Compilation
unit analysis terminated
2/53 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
The function is given below.
1 create or replace function
2 compute_statistics(ssn1 in student.ssn%type) return stats_record
3 is
4 type mytype is record(first_name student.first_name%type, last_name
5 student.last_name%type,notlate number,late number);
6 stats_record mytype;
7 begin
8 select first_name,last_name into myrec.first_name,myrec_last_name from student
9 where ssn=ssn1;
10 select count(*) into myrec.notlate from transaction where status=1 and ssn=ssn1;
11 select count(*) into myrec.late from transaction where ssn=ssn1;
12 return (myrec);
13 exception
14 when no_data_found then
15 dbms_output.put_line('Invalid ssn or ssn not found');
16* end compute_statistics;
Plz help