当前位置: 代码迷 >> SQL >> 关于sql oop 步骤小例子
  详细解决方案

关于sql oop 步骤小例子

热度:179   发布时间:2016-05-05 13:38:57.0
关于sql oop 方法小例子

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.
  相关解决方案