我有一个表示为001.002.0003.0000.000.000的帐号 每个。中断代表代码
所以001 =资金002 =程序,依此类推。
我正在尝试在插入项上为这些项目创建字段,以便我可以按汇总汇总的类别进行分组
我觉得我已经很近了,但是还不很远。
DELIMITER $$
CREATE TRIGGER before_general_ledger_insert
BEFORE INSERT ON general_ledger
BEGIN
DECLARE general_ledger_account integer;
SUBSTRING_INDEX( `general_ledger_account` , '.', 1 ) AS general_ledger_fund_id,
SUBSTRING_INDEX(SUBSTRING_INDEX( `general_ledger_account` , '.', 2 ),'.',-1) AS general_ledger_program_id,
SUBSTRING_INDEX(SUBSTRING_INDEX( `general_ledger_account` , '.', -2 ),'.',1) AS general_ledger_function_id,
SUBSTRING_INDEX( `general_ledger_account` , '.', -1 ) AS general_ledger_object_id
INSERT INTO general_ledger_fund_id, general_ledger_program_id, general_ledger_function_id, general_ledger_object_id
SET action = 'insert',
END$$