I want to make a copy of every record inserted in jobact to a new table jobactupdates. I am using a stored procedure for this purpose. Both tables are exactly the same and have same no of columns. When I insert data in jobact using insert query then, the stored procedure fails and show the Data Type mismatch error.
My code looks like this:
PROCEDURE insertData
INSERT INTO jobactupdates (jobcode ,jobdescr ,fileno ,port ,mastcode ,mastdescr ,mastdescr1 ,shipper ,goods ,unit1 ,qty ,unit ,vesname ,arremarks ,arrdate ,remarks ,docstat ,docdate ,blno ,bldate ,jastat ,rate ,demand ,received ,balance ,transpor,dldate);
VALUES(jobact.jobcode,jobact.jobdescr,jobact.fileno,jobact.port,jobact.mastcode,jobact.mastdescr,jobact.mastdescr1,jobact.shipper,jobact.goods,jobact.unit1,jobact.qty,jobact.unit,jobact.vesname,jobact.arremarks,jobact.arrdate,jobact.remarks,jobact.docstat,jobact.docdate,jobact.blno,jobact.bldate,jobact.jastat,jobact.rate,jobact.received,jobact.balance,jobact.transpor,jobact.dldate);
ENDPROC
A Data Type Mismatch error occurs when you try to insert an inappropriate data type into a field. For example, if you try to store a string into an integer field. I would double check the table structures and confirm that they are identical.
Another thing to be aware of is if any of the JOBACT field types are set to Integer (AutoInc). They will have to be set to just Integer in the JOBACTUPDATES table. Otherwise you will get a "Field is read-only" error message.