How to create Hex value in Form6 [message #347263] |
Thu, 11 September 2008 03:46 |
oracle_user1
Messages: 45 Registered: May 2008
|
Member |
|
|
Hi to all,
How to generate the value to hexadecimal code.
create table test
(trxno varchar2(15),
trxdt date)
I want store the trxno in hexadecimal code.
Hope can get help from you all experts there.
Thanks.
Regards,
oracle user
|
|
|
Re: How to create Hex value in Form6 [message #347383 is a reply to message #347263] |
Thu, 11 September 2008 07:47 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Hexadecimal? You mean, using digits from 0 - 9, as well as letters A - F?
If that's so, knowing that "trxno" column is of a character datatype, no problem; just insert a value into this column, such as SQL> insert into test (trxno) values ('BC1');
1 row created.
SQL>
On the other hand, if you want to convert a decimal (or binary or octal or ...) number into a hexadecimal one, that's another problem which, actually, has nothing much to do with Oracle, but your ability to adjust decimal -> hexadecimal conversion algorithm into Oracle (PL/)SQL code.
Or, you might even use available TO_NUMBER and TO_CHAR functions to do the job, such asSQL> select to_char(3009, 'xxxx') dec_to_hex from dual;
DEC_T
-----
bc1
SQL> select to_number('bc1', 'xxx') hex_to_dec from dual;
HEX_TO_DEC
----------
3009
SQL>
|
|
|