我正在尝试gender = document.querySelector('input[name="gender"]:checked').value;
从Ins
col到bigint
col,我收到此错误
bigint
这是查询模式
Error 5407 Invalid operation for DateTime or Interval.
我能做到这一点
INSERT INTO sanboxdb.Mtb ( colA < offending column is BIGINT > ,
<other non offensive col-list> )
SELECT
( TRIM(Ptb.Colx) ||
TRIM(Coly)||
TRIM(ROW_NUMBER() OVER (PARTITION BY Xtb.ColZ
ORDER BY ColP,ColQ ) +
COALESCE(SUBSTR(CAST(Mtb.ColA_BigIntCol AS CHAR (20)),
6),0) ) ) ( BIGINT) AS colA /* , TYPE ( colA ). I verified that type is indeed BIGINT */,
<rest of the query Logic here.All the rest of the col checkout fine>'
它不会抱怨!
但如果我这样做
`Ins into ( BigintCol) sel '1123343434'` <br>
或实际上是
ins into DB.TB ( Bigintcol ) sel substring ( bigintcol,6,0) from DB.TB sample 5
它不喜欢这个。您可以忽略此组件
ins into DB.TB ( Bigintcol ) sel substring ( bigintcol,6,0) ( bigint) from DB.TB sample 5
我将其包含在内以显示实际的查询大纲,但攻击性组件是此部分
( TRIM(Ptb.Colx) ||
TRIM(Coly)||
TRIM(ROW_NUMBER() OVER (PARTITION BY Xtb.ColZ
ORDER BY ColP,ColQ ) +
这些 COALESCE(SUBSTR(CAST(Mtb.ColA_BigIntCol AS CHAR (20)),
6),0) ) )
都不是datatypes
或Interval
。实际上它是相同的datetime
。那么为什么会抛出这样的错误。
答案 0 :(得分:1)
当我模拟像你这样的场景时,我没有遇到任何问题,你有可能为bigintcol提供样本值吗?或尝试构建类似我和调试的类似场景。
/* create table with bigint column */
create table test3
( a bigint)
primary index(a);
/* inserted bigint value */
insert into test3 values(9223372036854775807);
/* selected bigint as character and operation you want to perform */
select cast(a as char(19)), COALESCE(SUBSTR(CAST(a AS CHAR (20)),6),0) bi
from test3;
/* inserted char value in bigint column*/
insert into test3
select COALESCE(SUBSTR(CAST(a AS CHAR (20)),6),0) bi
from test3;