12c and Java8
-
Two new products we can now hate.
-
From 12c database, it is possible to have the sequence directly in the column definition and thus saving ugly triggers.
-
@Nagesh said:
From 12c database, it is possible to have the sequence directly in the column definition and thus saving ugly triggers.
Here's the office example:
CREATE SEQUENCE t1_seq;
CREATE TABLE t1 (
id NUMBER DEFAULT t1_seq.NEXTVAL,
description VARCHAR2(30)
);INSERT INTO t1 (description) VALUES ('DESCRIPTION only');
INSERT INTO t1 (id, description) VALUES (999, 'ID=999 and DESCRIPTION');
INSERT INTO t1 (id, description) VALUES (NULL, 'ID=NULL and DESCRIPTION');SELECT * FROM t1;
ID DESCRIPTION
1 DESCRIPTION only 999 ID=999 and DESCRIPTION ID=NULL and DESCRIPTION
3 rows selected.
-
This guy worked in PLSQL and look what happened to him.
[IMG]http://i.imgur.com/uSt96H5.jpg[/IMG]
-
@Nagesh said:
This guy worked in PLSQL and look what happened to him.
He lost all his hair and aged ten years overnight? Sign me up!
-
@Nagesh said:
@Nagesh said:
From 12c database, it is possible to have the sequence directly in the column definition and thus saving ugly triggers.
Here's the office example:
CREATE SEQUENCE t1_seq;
CREATE TABLE t1 (
id NUMBER DEFAULT t1_seq.NEXTVAL,
description VARCHAR2(30)
);INSERT INTO t1 (description) VALUES ('DESCRIPTION only');
INSERT INTO t1 (id, description) VALUES (999, 'ID=999 and DESCRIPTION');
INSERT INTO t1 (id, description) VALUES (NULL, 'ID=NULL and DESCRIPTION');SELECT * FROM t1;
ID DESCRIPTION
1 DESCRIPTION only 999 ID=999 and DESCRIPTION ID=NULL and DESCRIPTION
3 rows selected.
So after 998 more default insertions there's going to be a collision with the 999 record you inserted? Brillant!
-
@joe.edwards said:
@Nagesh said:
@Nagesh said:
From 12c database, it is possible to have the sequence directly in the column definition and thus saving ugly triggers.
Here's the office example:
CREATE SEQUENCE t1_seq;
CREATE TABLE t1 (
id NUMBER DEFAULT t1_seq.NEXTVAL,
description VARCHAR2(30)
);INSERT INTO t1 (description) VALUES ('DESCRIPTION only');
INSERT INTO t1 (id, description) VALUES (999, 'ID=999 and DESCRIPTION');
INSERT INTO t1 (id, description) VALUES (NULL, 'ID=NULL and DESCRIPTION');SELECT * FROM t1;
ID DESCRIPTION
1 DESCRIPTION only 999 ID=999 and DESCRIPTION ID=NULL and DESCRIPTION
3 rows selected.
So after 998 more default insertions there's going to be a collision with the 999 record you inserted? Brillant!No there won't, there'll just be two records with 999 for the id.
-
After 998 records, it will be have two records with 999, unless I specify a primary key and then the insert after that will simply insert a record with id = 1000. Also this example is from Oracle's documentation.
@joe.edwards said:
@Nagesh said:
@Nagesh said:
From 12c database, it is possible to have the sequence directly in the column definition and thus saving ugly triggers.
Here's the office example:
CREATE SEQUENCE t1_seq;
CREATE TABLE t1 (
id NUMBER DEFAULT t1_seq.NEXTVAL,
description VARCHAR2(30)
);INSERT INTO t1 (description) VALUES ('DESCRIPTION only');
INSERT INTO t1 (id, description) VALUES (999, 'ID=999 and DESCRIPTION');
INSERT INTO t1 (id, description) VALUES (NULL, 'ID=NULL and DESCRIPTION');SELECT * FROM t1;
ID DESCRIPTION
1 DESCRIPTION only 999 ID=999 and DESCRIPTION ID=NULL and DESCRIPTION
3 rows selected.
So after 998 more default insertions there's going to be a collision with the 999 record you inserted? Brillant!
-
For folks hating on sequence columns, oracle also has identity column introduced in 12C.
-
His name is Steven Feurstein and I think IMHPO, that he is second only to Thomas Kyte.@joe.edwards said:
@Nagesh said:
This guy worked in PLSQL and look what happened to him.
He lost all his hair and aged ten years overnight? Sign me up!