DECLARE CURSOR CUR_M_SHOHINHOTEL IS SELECT H.SEQ, H.USEDATE, TO_CHAR(TO_DATE('2006/12/12') + H.USEDATE - 1, 'YYYYMMDD') AS USEDAY, H.HOTELCD, H.MEALTYPECD, H.ROOMCATEGORYCD, H.OUTPUTFLAG, H.TKTCD, H.TKTREMARKSCD, H.SUPPLIERCD, H.SORTORDER, R.NAME AS TKTREMARKSNAME, L.NAME, L.TEL, H.REMARKSCD,H.SEQREMARKS, L.DISPLAYFLAG From M_SHOHINHOTEL H, M_HOTEL L, M_TKTREMARKS R WHERE H.TKTREMARKSCD = R.CODE(+) AND H.HOTELCD = L.CODE(+) AND H.CODE1 = '00' AND " H.CODE2 = '0000' AND " H.CODE3 = '00' ORDER BY H.USEDATE,H.SEQ; TYPE_M_SHOHINHOTEL CUR_M_SHOHINHOTEL%ROWTYPE; BEGIN OPEN CUR_M_SHOHINHOTEL; LOOP FETCH CUR_M_SHOHINHOTEL INTO TYPE_M_SHOHINHOTEL; EXIT WHEN CUR_M_SHOHINHOTEL%NOTFOUND; INSERT INTO Y_HOTEL( BRANCHCD, BOOKINGNO, REV, SEQ, STDATE, USEDATE, HOTELCD, MEALTYPECD, FIRSTFLAG, ROOMCATEGORYCD, TKTCD, TKTREMARKSCD, TKTREMARKSDETAIL,REGDATE, REGTIME, UPDCHARGER, DISPLAYFLAG, SUPPLIERCD, SORTORDER, HISTORYDATE, PAXMALE, PAXFEMALE, PAXCHILD, PAXINFANT, STATUS, TEHAISTATUS,OUTPUTFLAG, UPDCHARGERCD, HOTELNAME, HOTELTEL, REMARKSCD, SEQREMARKS ) VALUES ( 'SZ', '123456', '00', TYPE_M_SHOHINHOTEL.SEQ, TYPE_M_SHOHINHOTEL.USEDATE, YPE_M_SHOHINHOTEL.USEDAY , TYPE_M_SHOHINHOTEL.HOTELCD, TYPE_M_SHOHINHOTEL.MEALTYPECD, '1', TYPE_M_SHOHINHOTEL.ROOMCATEGORYCD, TYPE_M_SHOHINHOTEL.TKTCD, TYPE_M_SHOHINHOTEL.TKTREMARKSCD," TYPE_M_SHOHINHOTEL.TKTREMARKSNAME, TO_CHAR(SYSDATE,'YYYYMMDD')," TO_CHAR(SYSDATE,'HH24MISS')," 'ZHUIMENGKE', TYPE_M_SHOHINHOTEL.DISPLAYFLAG, '1', TYPE_M_SHOHINHOTEL.SUPPLIERCD, TYPE_M_SHOHINHOTEL.SORTORDER, TO_CHAR(SYSDATE,'YYYYMMDD'), 1, 2, 3, 4, '0', '0', TYPE_M_SHOHINHOTEL.OUTPUTFLAG, 'ZHUIMENGKE', TYPE_M_SHOHINHOTEL.NAME, TYPE_M_SHOHINHOTEL.TEL, TYPE_M_SHOHINHOTEL.REMARKSCD, TYPE_M_SHOHINHOTEL.SEQREMARKS); END LOOP; CLOSE CUR_M_SHOHINHOTEL; END;