2009-01-05 6 views

Antwort

7

Dies scheint zu funktionieren:

CAST(X'3e000000' AS INT) 
22

Wie Sie bemerkt haben, können Sie mit einem bit-string constant in hexadezimal geschrieben starten, und dann type-cast it auf die Art Sie wollen. So

INSERT INTO foo (i) VALUES (CAST(x'1234' AS int)) 

oder

INSERT INTO foo (i) VALUES (x'1234'::int) -- postgres-specific syntax