Create Table Statement
We can create a new table in the default database using command "CREATE TABLE tablename" . To create a table , you need to define it's column ,by providing the column's name , type and attributes.
CREATE TABLE table_name (
column1 datatype, column2 datatype,
column3 datatype,
..................
columnN datatype,
PRIMARY KEY( one or more columns ) );
DROP Table Statement
DROP TABLE Statement allows you to remove or delete a table from the database.
DROP TABLE tablename
[ CASCADE CONSTRAINTS ] ;
NOTE: CASCADE CONSTRAINTS is optional. If specified, all referential integrity constraints will be dropped as well.
- If there are referential integrity constraints on table_name and you do not specify the CASCADE CONSTRAINTS option, the DROP TABLE statement will return an error and Oracle will not drop the table.
INSERT INTO Statement
INSERT INTO table_name( column1, column2....columnN)
VALUES
( value1, value2....valueN);
Assigning SQLQuery Results To PL/SQL Variable
We can use the SELECT INTO statement of SQL to assign values to PL/SQL variables. For each item in the SELECT list, there must be a corresponding, type-compatible variable in the INTO list.
The following program assigns values from the customer table to PL/SQL variables using the SELECT INTO clause of SQL:
The following program assigns values from the above table to PL/SQL variables using the SELECT INTO clause of SQL:
No comments:
Post a Comment