I'm aware similar questions have been asked, but I can't seem to find something that works. I'm creating a table in oracle database which one column is an ID and the other column's value is a hexadecimal color value. When I created the table I put the datatype for the ID as a number and VARCHAR2 for the color. I just want to know if there is a way to generate random hex color values and update the table so that they can be in the color column. Thanks.
SELECT TO_CHAR( TRUNC( DBMS_RANDOM.VALUE( 0, 256*256*256 ) ), 'FM0XXXXX' )
FROM DUAL;
this should give you a pattern how to do it
select 1, to_char(floor(dbms_random.value(0,256)), 'XX') from dual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With