Home

Using Expressions

 

Description

There are various ways you can assist the user with data entry. For example, you can create an expression using arithmetic operators. You can create an expression when creating the table.

To create an expression when creating a table, provide the name of the column, type AS, open a parenthesis, type the desired expression, and close the parenthesis. Here is an example:

SQL> CREATE TABLE Circle
  2  (
  3     Radius number(8, 3),
  4     Area AS (Radius * Radius * 3.14159)
  5  );

Table created.

When performing data entry, you must not provide a value for a column that has an expression. Here is an example of entering data for the above Circle table:

SQL> INSERT INTO Circle(Radius) VALUES(46.82);

1 row created.

SQL> SELECT * FROM Circle;

    RADIUS       AREA
---------- ----------
     46.82 6886.71839

SQL>
 
 
     
 

Home Copyright © 2009-2010 FunctionX, Inc.