Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Wednesday, October 23, 2013

Sequences in Oracle



CREATE TABLE Samples
(
 SampID     NUMBER(4)
 Constraint SampID_PK PRIMARY  KEY,
 SampName   VARCHAR2(25),
 SampDate   DATE
 );

CREATE SEQUENCE SampleSeq
INCREMENT By 1
START WITH 0
MINVALUE 0
MAXVALUE 5
NOCACHE
NOCYCLE

INSERT INTO Samples
(SampID, SampName,  SampDate)
VALUES
(SampleSeq.NEXTVAL, 'SAMPLE', '31-AUG-05');

SELECT * FROM Samples;

CREATE TABLE SampleCy
(
 SampID     NUMBER(4)
 Constraint SampIDD_PK PRIMARY  KEY,
 SampName   VARCHAR2(25),
 SampDate   DATE
 );

CREATE SEQUENCE SampSeqC
INCREMENT By 1
START WITH 0
MINVALUE 0
MAXVALUE 5
NOCACHE
CYCLE

CREATE SEQUENCE SampSeqD
INCREMENT BY -1
START WITH 5
MAXVALUE 5
MINVALUE 0
NOCACHE
NOCYCLE;

No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect