Create Or Replace Type Cpm_Task As Object (
Start_Date Date,
Duration_Days Number(9,0),
Member Function Get_end_date Return Date,
member procedure set_Startdate(in_start_Date Date)
);
/
create or replace type body Cpm_Task
as
member function Get_end_date return date
is
Begin
return start_Date + Duration_Days;
end Get_end_date;
member procedure set_Startdate(in_start_Date date)
is
begin
start_Date := in_start_Date;
end set_Startdate;
End;
/
Declare
style_Cpm Cpm_Task ;
Begin
select Cpm_Task(Sysdate,1) into style_Cpm from dual ;
dbms_output.put_line(style_Cpm.Get_end_date);
end;
/
at this way, we can construct cpm in sql only and call its function to do things.