Technology Software

How to Alter a Table in Oracle Using SQL

    • 1). Connect to the Oracle SQL*Plus, click “Start,” “All Programs,” then click “SQLPlus.”

    • 2). Log on the Oracle SQL*Plus Dialog Box, enter “Username,” enter “Password,” then click “OK.”

    • 3). Describe the college_classes table that is located on the Oracle database. At the SQL> prompt type “DESCRIBE college_classes;”

      SQL> DESCRIBE college_classes

      Name Null? Type

      ----------------------------------------- ----------- ----------------------------

      CLASS_ID NOT NULL NUMBER(5)

      CLASS_NAME NOT NULL VARCHAR2(20)

      CLASS_DESCRIPTION NOT NULL VARCHAR2(50)

    • 4). Use alter table to increase the length of the class_name column of college_classes from 20 to 30.

      At the SQL> prompt

      type “ALTER TABLE college_classes

      MODIFY class_name VARCHAR2 (30);”

      *Note that you can only decrease the length of the column is there are no rows in the table or all the columns contain null columns.

    • 5). Use alter table to change the precision of the class_id column of college_classes from 5 to 10.

      At the SQL> prompt

      type “ALTER TABLE college_classes

      MODIFY class_id NUMBER (10);”

      *Note that you can only decrease the length of the column is there are no rows in the table or all the columns contain null columns.

    • 6). Use alter table to change the data type of the class_name from VARCHAR2 to CHAR.

      At the SQL> prompt

      type “ALTER TABLE college_classes

      MODIFY class_name CHAR(30);”

      *Note that is the table is empty or the column contains null values, you can change the column to any data type. Otherwise, you can only change the data type of a column to a compatible data type.

Related posts "Technology : Software"

How to Capture Analog Audio on My Computer

Software

Effective Photoshop Training Course to Enhance Your Photos

Software

How To Use Softphone Software For Your Business

Software

How to Access a String Array in JSP

Software

How Do I Get a Reversible Reaction Arrow in Microsoft Word 2007?

Software

How to Get AVCHD (MTS) Files to My PC

Software

Beat Detective Region Conform Tips

Software

MS BKF Repair Tool to Fix Corruption Owing to FAT File System

Software

Making an ASM Comparison

Software

Leave a Comment