Postgres:错误:运算符不存在:字符变化= bigint

Ath*_*lla 8 postgresql

我的查询是这样的.我尝试获取id列表的状态.

select order_number, order_status_name
from data.order_fact s
join data.order_status_dim l
on s.order_status_key = l.order_status_key
where 
order_number in (1512011196169,1512011760019,1512011898493,1512011972111)
Run Code Online (Sandbox Code Playgroud)

我得到一个错误虽然说:

ERROR:  operator does not exist: character varying = bigint
LINE 6: order_number in (1512011196169,1512011760019,1512011898493,1...
                     ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud)

你是否有任何关于我应该如何改造ID以使其发挥作用的线索?非常感谢!

a_h*_*ame 12

order_number是一个varchar,你无法将它与一个数字进行比较(123在SQL中是一个数字,'123'是一个字符串常量)

您需要使用字符串文字:

order_number in ('1512011196169','1512011760019','1512011898493','1512011972111')
Run Code Online (Sandbox Code Playgroud)

手册中的更多细节:http:
//www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS