i developing sms application , largely based on side of data using mysql, first experience stored procedures, triggers , transactions encounter problems, here's structure 1 of tables encounter problem:
create table if not exists `cfco_transaction` ( id_transac` `int (11) not null auto_increment, `cost_paid` float not null, `phone_number` decimal (9,0) not null, `money_transac` decimal (8,0) not null, `total_transac` dual not null, `transac_status` tinyint (1) not null default '0' `when_date` timestamp not null default current_timestamp, primary key (`id_transac`) unique key `phone_number` (` phone_number`) ) engine = innodb default charset = latin1 auto_increment = 1; i create procedure verifies there registration if cost_paid line money_transac different null , within cost_paid greater or equal 15000 if case makes update false true transac_status line otherwise false renregistre error in error tracking table , attempt following structure
create table if not exists `cfco_ticket_errors` ( id_error` `int (11) not null auto_increment, error` `varchar (100) not null, primary key (`id_error`) key error` `(` error`) ) engine = innodb default charset = latin1 auto_increment = 2; this did doesn't work
delimiter | create procedure update_status_transact (in transac_status boolean) begin if (cfco_transaction.cost_paid != null) , if (cfco_transaction.money_transac != null) update cfco_transaction.transac_status set 'true' id_transac= last_insert_id; end| delimiter; thank assistance
Comments
Post a Comment