开发者

Data type mismatch in foxpro stored procedure

开发者 https://www.devze.com 2023-01-22 20:30 出处:网络
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 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 ,deman开发者_如何学Pythond ,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.


For Character fields: write them into '' marks, Numeric fields: just numbers for example 123, Date fields: {^yyyy-mm-dd} (There can also optionally be time in Date field.)


Is this your actual query? If so, the fact your Columns and Values clauses contain different field lists has certainly caused this error:

Insert Into ...
bldate,
jastat,
rate,
demand,
received,
balance ..

Values ...
jobact.bldate, 
jobact.jastat,
jobact.rate, 
jobact.received, <--
jobact.balance,  <--
jobact.transpor  <--

.

0

精彩评论

暂无评论...
验证码 换一张
取 消