Oracle PL/SQL Tutorial/PL SQL Programming/TO NUMBER — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:08, 26 мая 2010
TO_CHAR(n2,"$9G999D99")
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 d1 DATE;
3 d2 DATE;
4 d3 DATE;
5 d4 DATE;
6 n1 NUMBER;
7 n2 NUMBER;
8 n3 NUMBER;
9 BEGIN
10 n2 := TO_NUMBER ("$1,235.95","$9G999D99");
11
12 DBMS_OUTPUT.PUT_LINE("n2 = " || TO_CHAR(n2,"$9G999D99"));
13
14 END;
15 /
n2 = $1,235.95
PL/SQL procedure successfully completed.
SQL>
SQL>
TO_NUMBER ("$1,235.95","$9G999D99")
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 d1 DATE;
3 d2 DATE;
4 d3 DATE;
5 d4 DATE;
6 n1 NUMBER;
7 n2 NUMBER;
8 n3 NUMBER;
9 BEGIN
10 n2 := TO_NUMBER ("$1,235.95","$9G999D99");
11
12 DBMS_OUTPUT.PUT_LINE("n2 = " || TO_CHAR(n2,"$9G999D99"));
13
14 END;
15 /
n2 = $1,235.95
PL/SQL procedure successfully completed.
SQL>
SQL>
TO_NUMBER ("123.99","999D99")
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 d1 DATE;
3 d2 DATE;
4 d3 DATE;
5 d4 DATE;
6 n1 NUMBER;
7 n2 NUMBER;
8 n3 NUMBER;
9 BEGIN
10 n1 := TO_NUMBER ("123.99","999D99");
11
12 DBMS_OUTPUT.PUT_LINE("n1 = " || TO_CHAR(n1,"999D99"));
13
14 END;
15 /
n1 = 123.99
PL/SQL procedure successfully completed.