Oracle Statement Subtotals

Source: Internet
Author: User
Tags savepoint

1. Oracle Statement Data Definition language (DDL)

1) CREATE table new tables

2) ALTER TABLE modification

3) Example of TRUNCATE table data:TRUNCATE table Stu;

4) DROP TABLE Delete tables

alter usage :

1. Add a field to the table:

ALTER TABLE Stu add age int;

2. Delete the fields in the table:

ALTER TABLE Stu drop column age;

3. Rename the field:

ALTER TABLE stu rename column sid to S#;

4. Change the data type of the field:

ALTER TABLE test00 Modify SSID varchar2 (10);

Note: You cannot change the data type of a field when the column is not empty

You can do this in the following ways:

New column B-Import a column of data -empty column A-convert a column type -import B Data transformation.


ALTER TABLE Stu add SSS float;

Update Stu set Sss=shigh;

Update stu Set shigh = null;

ALTER TABLE Stu Modify Shigh varchar2 (10);

Update stu Set shigh = SSS;

ALTER TABLE STU drop column SSS;

2. Data manipulation Language (DML) for Oracle statements

Data manipulation Language (DML):Select Delete Update Insert

1. Inserting data Insert

The column names can be omitted when the data is inserted in the same order, quantity, and table.

Insert into Stu values ();

The column name must be indicated when the inserted data order or quantity is inconsistent with the table.
INSERT into students (id,name) VALUES (10139, ' King II ');

2. Updating Data update
Syntax format:

Update <table_name> Set <column_name>= ...

[WHERE condition (s)];

--Update all records in this column without using the WHERE clause.

--use the WHERE clause to update the eligible records in this column.
3. Delete the data delete, TRUNCATE TABLE
Syntax format:
DELETE from <table_name>
[WHERE condition (s)];
--Delete all records in the table without using the WHERE clause.
--Use the WHERE clause to delete the qualifying records in the table.

3, Oracle Statement of Things Control Language (TCL)

Transaction Control Language (TCL): Commit savepoint rollback

Commit-commit and end transaction processing

ROLLBACK-undo completed work in a transaction

savepoint– marks a point in a transaction that can be rolled back


SavePoint A1;

Update stu set sname= ' white ' where id=3;

SELECT * from Stu;

SavePoint A2;

Delete from Stu where id=2;

SELECT * from Stu;

SavePoint A3;

Rollback to savepoint A2;

Rollback to the location of A2, a2 after the operation is all obsolete.

4. Oracle Statement Data Control Language (DCL)

Data Control Language (DCL): Grant Revoke

Licensing and Recycling permissions

Oracle Statement Subtotals

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.