Professional Documents
Culture Documents
|
CREATE DEFINER=`root`@`%` TRIGGER trader1_AFTER_INSERT AFTER INSERT ON
accountcreation
FOR EACH ROW
BEGIN
end if;
END
|
drop trigger if exists trader1_AFTER_UPDATE;
|
CREATE DEFINER=`root`@`%` TRIGGER trader1_AFTER_UPDATE AFTER UPDATE ON
accountcreation
FOR EACH ROW
BEGIN
end if;
END
|
drop trigger if exists trader1_AFTER_DELETE;
|
CREATE DEFINER=`root`@`%` TRIGGER trader1_AFTER_DELETE AFTER DELETE ON
accountcreation
FOR EACH ROW
BEGIN
END
|
drop trigger if exists branch_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER branch_AFTER_INSERT AFTER INSERT ON branch
FOR EACH ROW
BEGIN
insert into
trig_table(table_name,new_code,insert_date_time,upload_status,upload_date_time,uplo
ad_error_msg,priority)
values ('branch',NEW.BR_ID,NOW(),3,NULL,null,1);
end if;
END
|
drop trigger if exists branch_AFTER_UPDATE;
|
CREATE DEFINER=`root`@`%` TRIGGER branch_AFTER_UPDATE AFTER UPDATE ON branch
FOR EACH ROW
BEGIN
select new.br_id
into branchId from branch
where br_id=old.br_id;
END
|
drop trigger if exists branch_AFTER_DELETE;
|
CREATE DEFINER=`root`@`%` TRIGGER branch_AFTER_DELETE AFTER DELETE ON branch
FOR EACH ROW
BEGIN
end if;
END
|
drop trigger if exists chickplaced_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER chickplaced_AFTER_INSERT AFTER INSERT ON
chickplaced
FOR EACH ROW
BEGIN
select concat(new.farmer_id,':',new.shed_no,':',new.batch_no)
into batchNo from chickplaced
where farmer_id=old.farmer_id and shed_no=old.shed_no and batch_no=old.batch_no;
END
|
drop trigger if exists chicksalevoucherno_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER chicksalevoucherno_AFTER_INSERT AFTER INSERT ON
chicksalevoucherno
FOR EACH ROW
BEGIN
if not exists (select new_code from trig_table where new_code=new.voucher_no)
then
insert into
trig_table(table_name,new_code,insert_date_time,upload_status,upload_date_time,uplo
ad_error_msg,priority)
values ('chicksalevoucherno',new.voucher_no,NOW(),3,NULL,null,11);
end if;
END
|
drop trigger if exists chicksalevoucherno_AFTER_DELETE;
|
CREATE DEFINER=`root`@`%` TRIGGER chicksalevoucherno_AFTER_DELETE AFTER DELETE ON
chicksalevoucherno
FOR EACH ROW
BEGIN
if exists (select new_code from trig_table where new_code=old.voucher_no)
then
delete from trig_table where new_code=old.voucher_no;
end if;
END
|
drop trigger if exists supervisor_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER supervisor_AFTER_INSERT AFTER INSERT ON employee
end if;
END
|
drop trigger if exists supervisor_AFTER_UPDATE;
|
CREATE DEFINER=`root`@`%` TRIGGER supervisor_AFTER_UPDATE AFTER UPDATE ON
employee
FOR EACH ROW
BEGIN
select new.emp_id
into empId from employee
where emp_id=old.emp_id;
else
insert into
trig_table(table_name,new_code,insert_date_time,upload_status,upload_date_time,uplo
ad_error_msg,priority)
values ('supervisor',NEW.emp_id,NOW(),3,NULL,null,2);
end if;
END
|
drop trigger if exists supervisor_AFTER_DELETE;
|
CREATE DEFINER=`root`@`%` TRIGGER supervisor_AFTER_DELETE AFTER DELETE ON employee
FOR EACH ROW
BEGIN
end if;
END
|
drop trigger if exists trader_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER trader_AFTER_INSERT AFTER INSERT ON
ledgerdetails
FOR EACH ROW
BEGIN
END
|
drop trigger if exists trader_AFTER_UPDATE;
|
CREATE DEFINER=`root`@`%` TRIGGER trader_AFTER_UPDATE AFTER UPDATE ON
ledgerdetails
FOR EACH ROW
BEGIN
if(ledgerGroup in ('C','S'))
then
if exists (select new_code from trig_table where new_code=old.ledger_id)
then
update trig_table set insert_date_time=NOW() , upload_status=3 where
new_code=ledgerId;
else
insert into
trig_table(table_name,new_code,insert_date_time,upload_status,upload_date_time,uplo
ad_error_msg,priority)
values ('ledgerdetails',NEW.ledger_id,NOW(),3,NULL,null,4);
end if;
end if;
END
|
drop trigger if exists trader_AFTER_DELETE;
|
CREATE DEFINER=`root`@`%` TRIGGER trader_AFTER_DELETE AFTER DELETE ON
ledgerdetails
FOR EACH ROW
BEGIN
END
|
drop trigger if exists farmer_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER farmer_AFTER_INSERT AFTER INSERT ON newfarmer
FOR EACH ROW
BEGIN
END
|
drop trigger if exists farmer_AFTER_UPDATE;
|
CREATE DEFINER=`root`@`%` TRIGGER farmer_AFTER_UPDATE AFTER UPDATE ON newfarmer
FOR EACH ROW
BEGIN
select new.farmer_id
into farmerId from newfarmer
where farmer_id=old.farmer_id;
end if;
END
|
drop trigger if exists sheddetailtransaction_AFTER_INSERT;
|
CREATE DEFINER=`root`@`%` TRIGGER sheddetailtransaction_AFTER_INSERT AFTER INSERT
ON sheddetailtransaction
FOR EACH ROW
BEGIN
END
|
drop trigger if exists sheddetailtransaction_AFTER_UPDATE;
|
CREATE DEFINER=`root`@`%` TRIGGER sheddetailtransaction_AFTER_UPDATE AFTER
UPDATE ON sheddetailtransaction
FOR EACH ROW
BEGIN
select concat(new.shed_no,':',farmerId)
into shedNo from sheddetailtransaction
where shed_no=new.shed_no and tr_id=new.tr_id limit 1;
END
|
drop trigger if exists sheddetailtransaction_AFTER_DELETE;
|
CREATE DEFINER=`root`@`%` TRIGGER sheddetailtransaction_AFTER_DELETE AFTER
DELETE ON sheddetailtransaction
FOR EACH ROW
BEGIN
END
|