Plus two number type columns together : Number « SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL>
SQL>
SQL> CREATE TABLE myTable (
  2       name  VARCHAR2(25),
  3       price NUMBER(4,2),
  4       sales_tax     NUMBER(4,2),
  5       start_date DATE,
  6       salesperson   VARCHAR2(3));

Table created.

SQL>
SQL> INSERT INTO myTable VALUES ('Product Name 1', 1, .08, '5-NOV-04', 'AB');

1 row created.

SQL> INSERT INTO myTable VALUES ('Product Name 2', 2.5, .21, '29-JUN-05', 'CD');

1 row created.

SQL> INSERT INTO myTable VALUES ('Product Name 3', 50.75, 4.19, '10-DEC-06', 'EF');

1 row created.

SQL> INSERT INTO myTable VALUES ('Product Name 4', 99.99, 8.25, '31-AUG-07', 'GH');

1 row created.

SQL> SELECT * FROM myTable;


NAME                           PRICE  SALES_TAX START_DAT SAL
------------------------- ---------- ---------- --------- ---
Product Name 1                     1        .08 05-NOV-04 AB
Product Name 2                   2.5        .21 29-JUN-05 CD
Product Name 3                 50.75       4.19 10-DEC-06 EF
Product Name 4                 99.99       8.25 31-AUG-07 GH

4 rows selected.

SQL> SELECT name, price + sales_tax FROM myTable;


NAME                      PRICE+SALES_TAX
------------------------- ---------------
Product Name 1                       1.08
Product Name 2                       2.71
Product Name 3                      54.94
Product Name 4                     108.24

4 rows selected.

SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>








10.9.Number
10.9.1.Number column
10.9.2.Plus two number type columns together
10.9.3.Compare Number type in where clause
10.9.4.NUMBER data type
10.9.5.NUMBER datatype: PRECISION 5 SCALE 2
10.9.6.NUMBER(4,2) as column type
10.9.7.select 5.1d, 42f from dual;
10.9.8.Use IN for number value