Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting binary to varchar in PL/SQL

My table consists of a field that is binary_double. However I want to convert it to varchar.

The column currently has sample values stored as binary_double. It looks like this:

69623829

I want the result to be returned in the same format when I convert it to varchar. So expected output is like this:

69623829

I have tried this:

select
  convert(varchar(20),r.col_14,1)
from sample_table r

The error message is:

ORA-00936: missing expression

p.s : I am just starting off in PL/SQL

like image 824
Trillian Avatar asked Dec 18 '25 17:12

Trillian


1 Answers

I suggest using TO_CHAR function. See TO_CHAR. As in

SELECT TO_CHAR(col14,'99999999') FROM sample_table

Please see linked documentation for the desired format according to your requirements.

like image 189
Thinkeye Avatar answered Dec 20 '25 11:12

Thinkeye



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!