Thursday, December 12, 2019

Inserting Negative values into a table in Oracle

SQL> SET DEFINE OFF;
SQL> SET LINES 100;
SQL> SET PAGES 50;
SQL>
SQL> DROP TABLE t;

Table dropped.

SQL>
SQL> CREATE TABLE t(msg  VARCHAR2 (11), num_col NUMBER (9, 2));

Table created.

SQL>
SQL> INSERT INTO t (msg, num_col) VALUES ('9994999', TO_NUMBER ('9994999'));

1 row created.

SQL> INSERT INTO t (msg, num_col) VALUES ('9994999.99', TO_NUMBER ('9994999.99'));

1 row created.

SQL> INSERT INTO t (msg, num_col) VALUES ('-9994999.99', TO_NUMBER ('-9994999.99'));

1 row created.

SQL> INSERT INTO t (msg, num_col) VALUES ('+7777777.99', TO_NUMBER ('+7777777.99'));

1 row created.

SQL> COMMIT;

Commit complete.

SQL>
SQL> SELECT * FROM t;

MSG            NUM_COL
----------- ----------
9994999        9994999
9994999.99  9994999.99
-9994999.99   -9995000
+7777777.99 7777777.99

SQL>
SQL> create table b(b number);

Table created.

SQL> insert into b values(to_number('-1'));

1 row created.

SQL> insert into b values(to_number('-2'));

1 row created.

SQL> insert into b values(to_number('-3'));

1 row created.

SQL> insert into b values(to_number('-4'));

1 row created.

SQL> insert into b values(to_number('-5'));

1 row created.

SQL> commit;

Commit complete.

SQL> select * from b;

         B
----------
        -1
        -2
        -3
        -4
        -5

SQL>

No comments:

Post a Comment

Delete Row Button to all records of Interactive Report in Oracle Apex

 1. add 'Delete' Del column to Report Query 2. Set the Following Properties for the DEL Column Type: Link Heading: Delete Targ...