Oracle PL/SQL - Fixed-point variables:Setting Precision and Scale

Introduction

v1_nr is a fixed-point number with 5-digit precision and positive scale of 2.

The code assigns a numeric literal to it with 3 digits before and after the decimal point.

v2_nr is a fixed-point number with 5-digit precision and negative scale of -2.

The code is assigning a numeric literal to it with 3 digits before and after the decimal point.

Demo

SQL>
SQL> declare--   www.ja  v a  2s.  c o m
  2       v1_nr NUMBER(5,2) := 123.567;
  3       v2_nr NUMBER(5,-2) := 123.567;
  4  begin
  5      DBMS_OUTPUT.put_line(v1_nr||' and '||v2_nr);
  6  end;
  7  /
123.57 and 100

PL/SQL procedure successfully completed.
SQL>

Related Topic