No operator matches the given name and argument types. You might need to add explicit type casts

No operator matches the given name and argument types. You might need to add explicit type casts,第1张

文章目录
tips:第一次使用PostgreSQL,发现的问题。

【 报错信息】: No operator matches the given name and argument types. You might need to add explicit type casts
【翻译信息】:没有与给定名称和参数类型匹配的运算符。您可能需要添加显式类型转换

讲人话就是:类型不匹配,你需要转换数据类型。

如果是字符串类型:直接加单引号即可。
在mysql中:" " 和 ’ ’ 通用。
在PostgreSQL中:字符串用 ’ ’ ,关键字作为表名或列名用" "
SELECT * FROM tablename WHERE phone_number = ‘15377777777’

1.cast(字段 as 类型)

SELECT * FROM tablename WHERE phone_number = cast(15377777777 as VARCHAR)

2.字段 :: 类型

SELECT * FROM tablename WHERE phone_number = 15377777777 :: VARCHAR

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/991645.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存