SELECT unix_timestamp(CURRENT_DATE());
delimiter $$
drop procedure generateTaxDoc $$
CREATE PROCEDURE generateTaxDoc (
P_taxDoc varchar(10), P_employeeRecordid BIGINT UNSIGNED,P_employeeNumber BIGINT UNSIGNED,P_year INT UNSIGNED)
BEGIN
declare datetimer BIGINT;
declare mycount int(4);
select count(*) into mycount from taxDoc where taxdoc=P_taxdoc and employeeRecordid=P_employeeRecordid and year=P_year;
if (mycount=0) then
insert into taxDoc (taxdoc,employeeRecordID,employeeNumber,year,irxrecordid) values (P_taxdoc,P_employeeRecordid,P_employeeNumber,P_year,unix_timestamp(now())*10+P_employeeNumber);
end if;
END;
$$
call generateTaxDoc(1,2,3,0) $$
select * from taxDoc $$
沒有留言:
張貼留言