mysql line of script refuses to execute (no errors/warnings)
I have a very long script that imports a csv file into a holding table, does some massaging, then copies the data from the holding table into the final table.
When I run the script, everything executes except line 494:
UPDATE `database`.`holding`
SET `rcnt_rslts`=TRUE
WHERE `test_rcnt`=TRUE
AND (`rcntrslt`='pos' OR `rcntrslt`='neg' OR `rcntrslt`='indeterminate');
rcnt_rslts
in both tables is BOOL
/TINYINT(1)
and the lines above an below are nearly identical and are exec开发者_运维技巧uted just fine. There are no other references to rcnt_rslts
anywhere else in the script (verified with find/replace).
If I past that line directly into the CMI, it works.
Is there a line/size limit and mysql just randomly picked a line to ignore?
edit: if it matters, all values in rcnt_rslts
are NULL
after the script runs.
OK I'll give it a try:
1- Maybe you made a typo in rcntrslt
, do it like this and you only list it once.
UPDATE `database`.holding
SET rcnt_rslts=TRUE
WHERE test_rcnt=TRUE
AND (rcntrslt IN ('pos','neg','indeterminate'));
2- =
can be case sensitive, LIKE
never is, try:
UPDATE `database`.holding
SET rcnt_rslts=TRUE
WHERE test_rcnt=TRUE
AND (rcntrslt LIKE 'pos' OR rcntrslt LIKE 'neg' OR rcntrslt LIKE 'indeterminate');
3- What other values can rcntrslt
have, you not reverse all the tests?
UPDATE `database`.holding
SET rcnt_rslts = TRUE
WHERE test_rcnt<>FALSE AND test_rcnt IS NOT NULL
AND (rcntrslt NOT IN ('othervalue','test1','gdsd')
AND rcntrslt IS NOT NULL;
4- Maybe there is some pollution in rcntrslt
causing spaces or other non-printable chars to be there.
UPDATE `database`.holding
SET rcnt_rslts=TRUE
WHERE test_rcnt=TRUE
AND (rcntrslt LIKE '%pos%' OR rcntrslt LIKE '%neg%'
OR rcntrslt LIKE '%indeterminate%');
5- If you want to debug, you can always do some diagnosic SELECTS in there to see what's going on.
CREATE TABLE log (
id integer auto_increment not null primary key,
logtime timestamp,
reason varchar(255) not null,
tablename varchar(255) not null,
fieldnames varchar(10000) not null,
values varchar(10000) not null,
INDEX log_time (logtime),
INDEX log_table (tablename),
INDEX log_reason (tablename, reason)) ENGINE = InnoDB;
INSERT INTO log (reason, tablename, fieldnames, values)
SELECT
'all values','holding', 'test_rcnt,rcntrslt'
, CONCAT(IFNULL(test_rcnt,'NULL'), ',' ,IFNULL(rcntrslt,'NULL')
FROM holding;
INSERT INTO log (reason, tablename, fieldnames, values)
SELECT
'test_rcnt = TRUE','holding', 'test_rcnt,rcntrslt'
, CONCAT(IFNULL(test_rcnt,'NULL'), ',' ,IFNULL(rcntrslt,'NULL')
FROM holding
WHERE test_rcnt = TRUE;
etc.
Now check the log to see what's wrong.
精彩评论