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

文章目录


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

上一篇:select总结


下一篇:SQLserver 查询表是否被哪些存储过程和视图引用