Oracle build table and set ID to auto grow ____oracle

Source: Internet
Author: User
Tags dba

CREATE tablespace shopping
datafile ' D:\oracle\mypc\oradata\orcl\shopping.dbf ' SIZE 20M 
autoextend on;

Create user shopping--creating username
identified by shopping-password password character
default tablespace shopping--default table space table space name
tem Porary Tablespace Shopping; --Temporary tablespace table space name


--gives permission
Grant connect to shopping with admin option;

--Role
Grant DBA to shopping with admin option;

Use SQL Plus to log in to the Administrator account and to grant DBA authority to shopping users

Grant DBA to Shopping;

The following is the automatic growth step for setting ID:

1, build the table

2. Construction sequence

3. Building triggers

Insert Auto Grow ID

INSERT into table_name (ID)
VALUES (bill_seq_id. Nextval);

Note: Later I encountered a problem, because my table has the field data is empty, the actual table design is not empty, I inserted the insert sentence of the data "NULL", so when inserting the automatic growth ID error:

Modify a table field check to be empty, unless the ID, the other fields can be empty, if not null, then the field data to be really not NULL to

Turn from: https://www.cnblogs.com/sincoolvip/p/5910751.html

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.