DROP PROCEDURE IF EXISTS `Sp_SendRequest`;
DELIMITER ;;
CREATE PROCEDURE Sp_SendRequest(
inRequestID Varchar(32),
inRequestTagID int(11),
inSendID varchar(30),
inOwnerID varchar(30)
)
BEGIN
set @days := 0;
set @timestamps := UNIX_TIMESTAMP();
select from_unixtime(@timestamps,'%d') into @days;
case @days
when 1 then insert into Tbl_FreeGift_01(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 2 then insert into Tbl_FreeGift_02(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 3 then insert into Tbl_FreeGift_03(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 4 then insert into Tbl_FreeGift_04(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 5 then insert into Tbl_FreeGift_05(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 6 then insert into Tbl_FreeGift_06(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 7 then insert into Tbl_FreeGift_07(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 8 then insert into Tbl_FreeGift_08(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 9 then insert into Tbl_FreeGift_09(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 10 then insert into Tbl_FreeGift_10(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 11 then insert into Tbl_FreeGift_11(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 12 then insert into Tbl_FreeGift_12(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 13 then insert into Tbl_FreeGift_13(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 14 then insert into Tbl_FreeGift_14(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 15 then insert into Tbl_FreeGift_15(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 16 then insert into Tbl_FreeGift_16(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 17 then insert into Tbl_FreeGift_17(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 18 then insert into Tbl_FreeGift_18(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 19 then insert into Tbl_FreeGift_19(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 20 then insert into Tbl_FreeGift_20(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 21 then insert into Tbl_FreeGift_21(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 22 then insert into Tbl_FreeGift_22(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 23 then insert into Tbl_FreeGift_23(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 24 then insert into Tbl_FreeGift_24(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 25 then insert into Tbl_FreeGift_25(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 26 then insert into Tbl_FreeGift_26(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 27 then insert into Tbl_FreeGift_27(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 28 then insert into Tbl_FreeGift_28(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 29 then insert into Tbl_FreeGift_29(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 30 then insert into Tbl_FreeGift_30(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
when 31 then insert into Tbl_FreeGift_31(RequestID,RequestTagID,SendID,OwnerID,StartTimeStamp) values(inRequestID,inRequestTagID,inSendID,inOwnerID,@timestamps);
end case;
END;;