create or replace PACKAGE BODY EsmsChinaNewsDY as 
    procedure spminterface_XW (phonenumber out Tphonenumber,Content out TContent,Re1 out TRe1) is 
CURSOR information_cur IS
                select SubjectCode from tb_bl_informationsubject where parentsubject='XW' and SupportSubscribe=1 and isenable=1;
percount NUMBER DEFAULT 1;
Var_SubjectCode  Tb_Bl_InformationSubject.SubjectCode%TYPE;
Var_Phonenumber  Tb_Bl_Subscribed.PhoneNumber%TYPE;
Var_Content Tb_Bl_Information.Content%TYPE;
Var_Sql Varchar2(200);
Var_LastSentDate  Date;
type t_no1 is cursor;
type t_no2 is cursor;
tmp_cursor t_no1;
tmp_cursor1 t_no2;
begin 
          FOR singleinformation IN information_cur
          LOOP
Var_SubjectCode:=singleinformation.subjectcode;
select LastSendTime into Var_LastSentDate from Tb_Bl_SubscribeState where subjectcode=Var_SubjectCode;
Var_Sql:="select Content from tb_bl_information where IssueDate>Var_LastSentDate and to_Date(IssueDate,YYYY-MM-DD)=to_Date(SysDate,YYYY-MM-DD) and isenable=0";
open tmp_cursor1 for Var_Sql;
           LOOP
           fetch tmp_cursor1 into Var_Content;
Var_Sql:="select PhoneNumber from Tb_Bl_Subscribed where SubjectCode=Var_SubjectCode and to_Date(Sysdate,YYYY-MM-DD) >=to_Date(startdate,YYYY-MM-DD) and isenable=0";
open tmp_cursor for Var_Sql;
LOOP
           fetch tmp_cursor into Var_Phonenumber;
                 phonenumber(percount) :=Var_Phonenumber;
                 Content(percount) := Var_Content;
                 Re1(percount) := "";
                 percount := percount + 1;
End LOOP;
Close tmp_cursor;
           END LOOP;
Close tmp_cursor1;
          END LOOP;
end spminterface_XW;
end EsmsChinaNewsDY;