Oracle Data Insertion

Source: Internet
Author: User

syntax structure: INSERT into table name (column name 1, column Name 2 ...) Values (value 1, value 2 ...)

Code Demo:

Sql> INSERT into Infos VALUES (①
2 ' s100102 ', ' lin ', ' Male ', 22, 2,
3 to_date (' 2009-8-9 06:30:10 ', ' yyyy-mm-dd HH24:MI:SS '), ②
4, default, ' 1001 ' ③
5);
Code parsing:
The ① table name is followed by the default column name, which defaults to all column names, and the value in values corresponds to the order of the columns in the table and the data type one by one.
In Sql*plus a statement can be written on multiple lines, and from the second line, Sqlplus will give the travel number to the front of each line.
② in Oracle, dates are internationalized, different regional installations of the database, the default date format is different, so for the program to be portable,
Date input to use the To_date function to format the date and format the date with a formatted string.
Characters in a formatted string are not case-sensitive, and common formatting characters are as follows:
The YYYY represents a four-digit year, the MM represents a two-digit month, the DD represents a date, and the hh24 represents an hour from 1-23;hh12 also represents the hour from 0-11;

Mi means minutes; SS represents seconds
③ You can use the default value instead when you encounter a column that has the defaults.
In Oracle, an INSERT command inserts a result set into a single table at once.

The statements used are: INSERT into table SELECT clause

Code Demo: Insert inserts a result set into a table

In this syntax, the data type of each column in the result set is required to conform to the data type of each column in the table, and the number of columns in the result set is the same as the number of columns in the table.

Oracle Data Insertion

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: info-contact@alibabacloud.com 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.