Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ** help with query?
Jack wrote:
> Jim,
>
> One last question, I think. I have found the table and field that I
> was looking for. Let's simplify it and say the table is CUSTOMER and
> the field is BALANCE and there is only one row.
>
> BALANCE is the varchar2(10) field. I would like to display the Hex
> value of this field from the sqlplus prompt. I was looking at the
> to_char function but am not sure how to do this.
>
> Could you help me with the Select that would display the hex value of
> BALANCE?
>
> Thanks,
> Jack
The BALANCE column is a VARCHAR2(10)?
You want to display the Hex value?
What Hex value? The Hex value of the ASCII characters?
Ok.
CREATE TABLE test (
testcol VARCHAR2(20));
INSERT INTO test VALUES ('PSOUG');
COMMIT;
SELECT utl_raw.cast_to_raw(testcol) RAWVAL
FROM test;
SELECT RAWTOHEX(utl_raw.cast_to_raw(testcol)) HEXVAL FROM test;
You will find the result from the two SELECT statements identical.
-- Daniel A. Morgan http://www.psoug.org damorgan_at_x.washington.edu (replace x with u to respond)Received on Wed Mar 08 2006 - 13:44:50 CST