创建记录、数组

--创建记录
TYPE REC_PERSON IS RECORD(
    PersonSID  varchar2(50),
    PersonName varchar2(60),
    Gender     varchar2(10),
    DepartSID  varchar2(50),
    IsSaler    char(1),
    IsAgent    char(1),
    IsDeliver  char(1),
    IsStorman  char(1),
    IsActive   char(1));
   
  R_PERSON REC_PERSON;
--创建数组
  TYPE TABLE_PERSON IS TABLE OF REC_PERSON
  INDEX BY BINARY_INTEGER;
 
  table_person_list TABLE_PERSON;
i:= 1;
  while i <= table_person_list.count LOOP
    R_PERSON := table_person_list(i);
END LOOP;
--PickStatusGather:记录,t_BorrowID 为记录中的数组
forall i in 1 .. r_PickStatusGather.t_BorrowID.count
      update LPMS.PIK_PickStatusGather
         set BeginTime = r_PickStatusGather.t_PickBeginTime(i),
             EndTime   = r_PickStatusGather.t_PickEndTime(i),
             UseTime   = r_PickStatusGather.t_PickUseTime(i)
       where BorrowID = r_PickStatusGather.t_BorrowID(i);
 
    r_PickStatusGather.t_BorrowID.delete;
    r_PickStatusGather.t_PickBeginTime.delete;
    r_PickStatusGather.t_PickEndTime.delete;
    r_PickStatusGather.t_PickUseTime.delete;
 
    --从分拣调度表中更新分拣班组ID
    select distinct t1.BorrowID, t2.PickTeamID bulk collect
      into r_PickStatusGather.t_BorrowID, r_PickStatusGather.t_PickTeamID
      from LPMS.PIK_PickStatusGather t1,
           LPMS.PIK_PickTeamAttemper t2,
           LTMP.TT_PIK_Borrow        t3
     where t1.ShelfID = t2.ShelfID
       and t1.BeginTime between t2.BeginTime and t2.EndTime
       and t1.BorrowID = t3.BorrowID;
posted on 2006-06-16 16:00  老狐狸  阅读(148)  评论(0)    收藏  举报