HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

Oracle SQL Tutorial : How to create Id with AUTO INCREMENT in Oracle PL SQL

26,545 views November 15, 2017 8:43

Watch on YouTube
ChannelTech Query Pond

Description from the creator

Oracle SQL Tutorial
Oracle tutorial: How to create Id with AUTO INCREMENT in Oracle

oracle tutorial for beginners

sequence in oracle

identity key in sql


In this Oracle tutorial , we can create an auto increment field using ‘sequence’
object that can be assigned as primary keys.

Using Oracle ‘sequence’ object, you can generate new values for a column.
An Oracle sequence is an object like a table or a stored procedure.

Examples


CREATE SEQUENCE SYSTEM.MYSEQ
START WITH 1
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;


CREATE OR REPLACE TRIGGER TR_CITY BEFORE INSERT ON CITY FOR EACH ROW
BEGIN SELECT LPAD(LTRIM(RTRIM(TO_CHAR(myseq.NEXTVAL))),10,'0') INTO :NEW.id FROM DUAL;

END;
/




Subscribe on youtube:
youtube.com/channel/UCpiyAesWNYOXSz5GPq8lbkA

For more tutorial please visit #techquerypond

techquerypond.wordpress.com

twitter.com/techquerypond

identity column

About this tutorial

Tech Query Pond published this 8:43 video tutorial on November 15, 2017. It has been watched 26,545 times on YouTube.

Duration
8:43
Published
November 15, 2017
Views
26,545
Likes
114

Tags

Share

This tutorial in other languages