开发者

HEX where clause in Postgre

开发者 https://www.devze.com 2023-03-26 05:08 出处:网络
I\'m new in postgreSQL how to d开发者_运维知识库o this select * from table_abc where table_abc.a>=7a and table_abc.b<=7a

I'm new in postgreSQL

how to d开发者_运维知识库o this

select * from table_abc where table_abc.a>=7a and table_abc.b<=7a

all value is HEX in column a, b and input value

Thanks

EDIT :

table_abc

a bytea
b bytea
c text


Careful, here. In Postgres, bytea is a byte array. You look like you want to store a single byte in those columns.

I don't see a single-byte type in the list of datatypes at http://www.postgresql.org/docs/9.0/static/datatype.html.

You can go with an integer type. For example, when I say this:

select x'7A'::integer

I get 122.

If you intend to store a single byte in these columns and write your queries with hex values, then I suggest you make the columns integers and query like this:

select * from table_abc where table_abc.a>=x'7a'::integer and table_abc.b<=x'7a'::integer
0

精彩评论

暂无评论...
验证码 换一张
取 消