Re: [SQL] parsing a string with a hexadecimal notation

2005-02-10 Thread KÖPFERL Robert
> So it should work to do "SELECT int4($1::bit varying)" and then pass > 'xBEEF' as the string value for the parameter. > > regards, tom lane Thanks, that worked for me ---(end of broadcast)--- TIP 3: if posting/reading thro

Re: [SQL] parsing a string with a hexadecimal notation

2005-02-09 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > You can do something like > foodb=# SELECT int4(X'FF'::bit varying); > int4 > -- > 255 > (1 row) > but i suspect you must prepare your statement out of sql. No, I think you could do it with a placeholder if you wanted. The secret is the (p

Re: [SQL] parsing a string with a hexadecimal notation

2005-02-09 Thread Achilleus Mantzios
O KΦPFERL Robert έγραψε στις Feb 9, 2005 : > I intend to retrieve an int value in an integer variable from a string with > a hexadecimal notation of a number. > Which function is appropriate to do > i int4 > i = ???('BEAF') You can do something like foodb=# SELECT int4(X'FF'::bit varying);