Error trying to convert char to number
I have an information, which I assume to be char type, since I have the following (dbms_output.put_line is a function like "print" and the returned value is after --> ):
dbms_output.put_line( table_record.column_1 ); --> 0.6
dbms_output.put_line( UPPER(table_record.column_1) ); --> 0.6
dbms_output.put_line( LOWER(table_record.column_1) ); --> 0.6
But I don't want that. I want to convert this column to FLOAT type. When I try:
dbms_output.pu开发者_运维问答t_line( to_number(crate_record.column_1) );
I have ORA-06502: PL/SQL: numeric or value error: character to number conversion error.
Why the to_number is not working?
Kindly try alter session and format mask
alter session set NLS_NUMERIC_CHARACTERS=".,"
dbms_output.put_line( to_number(crate_record.column_1,999999999.99) );
and if you want the same decimal and group separater for the whole application then change NLS_NUMERIC_CHARACTERS in DB for which below link might be helpful
https://forums.oracle.com/forums/thread.jspa?threadID=899739
精彩评论