O'Reilly logo

Beginning Oracle® Application Express by Paul Turley, Chris Leiter, Dan Wood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.2. Extending Existing Tables

There are three steps to go through to extend the data in a table. First, you have to expand the structure of the table. Next, you will have to get the customer data into the newly expanded table with an SQL script. The final step will be to quickly create some pages to maintain this data and add it to the list of maintenance pages you created in the last chapter.

Try It Out: Adding Columns to an Existing Table

You begin the process by adding more columns to the CUSTOMERS table.

  1. Go to the SQL Workshop, and select Object Browser > Browse > Tables from the cascading menus.

  2. Click on the CUSTOMERS table.

You can see that the CUSTOMERS table you created has just two columns. You have to add more columns to hold additional information about your customers.

  1. Click on Add Column to bring up the page shown in Figure 5-1.

On this page, you have to add a name for your new column, and make sure that the Type is appropriate for the data you will be storing in the column. You can also indicate that the column may or may not contain data by leaving the Nullable value to NULL.

You must allow NULL values for all new columns in this table, since rows already exist in the table, but the columns you will be adding to those rows will not have a value when first created.

  1. Set Add Column to CUST_STREET_ADDRESS, the Type to VARCHAR2 and the length to 200.

The Oracle database always stores VARCHAR2 columns as variable length columns, so the Length specification does not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required