Sometimes, when you use an OraclePLSQL query statement to convert a field of the number type to a field of the varchar2 type, it often appears on reports or pages:
Oracle PL/SQL query statements sometimes convert the number type field to the varchar2 type field, which often appears on reports or pages:
Oracle PL/SQL query statements sometimes convert the number type field to the varchar2 type
Reports or pages are frequently displayed:
. 440
. 441
1.0
10.100
And so on, or the 0 before the decimal point is removed by the to_char or cast function, or the 0 at the end of the invalid decimal point is not removed.
The jsp interface is easy to handle. You can use a method similar to the following:
Jsp code
Weight: (Km)
However, in a super report, the numbers to be displayed in cells are not very easy to process. You need to process the queried fields,
The following describes the solution:
Step 1: Save the 0 before the decimal point and remove the 0 at the end of the decimal point, and remove the redundant spaces generated by formatting:
Plsql code
Select t. num from (select ltrim (rtrim (to_char (0.44, '2017. 000 '), '0'), '') as num from dual unionselect ltrim (rtrim (to_char (0.441, '100. 000 '), '0'), '') as num from dual unionselect ltrim (rtrim (to_char (1.0, '100. 0 '), '0'), '') as num from dual unionselect ltrim (rtrim (to_char (10.100, '100. 000 '), '0'), '') as num from dual) t/* result: 0.2.16.4411.10.1 */
Step 2: Remove unnecessary decimal points:
Plsql code