This content has been marked as final. Show 3 replies
Hi try this
select l_value1/2 into
l_value2 from dual;
I wanted to know the reason behind it and is there any other standard function to display the result as required.
Oracle stores data for all datatypes in an internal format. Their is no concept of what data 'looks like'. Formatting functions are provided, and need to be used, to control formatting.
To 'see' a number it needs to be converted to a string. The TO_CHAR function is provided for that purpose and a format model can be provided to instructs the function how to format the data.
Different tools may use different format models when displaying the data.
So if you execute 'select 1/2 from dual;' in sql*plus it will display .5 but using Toad will display 0.5
See TO_CHAR in the SQL Reference
And Format Models
Table 2-13 describes each of the Number Format Elements that can be used in the format model.
Thanks rp0428 and *943428* for your answers.