Skip to content

Commit 41e1e6a

Browse files
Cleanup (#8)
Signed-off-by: GitHub Action <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub Action <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b0a306a commit 41e1e6a

File tree

4 files changed

+72
-30
lines changed

4 files changed

+72
-30
lines changed

features/boolean.adoc

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,83 @@ To declare a table column of type `BOOLEAN`, either use the `BOOLEAN` or `BOOL`
1111
[source,sql]
1212
[subs="verbatim"]
1313
----
14+
-- Create a new table containing two boolean columns
1415
CREATE TABLE email_addresses
1516
(
1617
user_id NUMBER NOT NULL,
1718
email VARCHAR2(255) NOT NULL,
1819
active BOOLEAN NOT NULL,
1920
primary BOOL NOT NULL
2021
);
22+
23+
-- Insert values into the table
24+
INSERT INTO email_addresses
25+
(user_id, active, primary, email)
26+
VALUES ( 1, true, true, 'jon.doe@example.com'),
27+
( 2, true, true, 'jane.smith@gmail.com'),
28+
( 2, false, false, 'jsmith@gmail.com'),
29+
( 3, true, true, 'max.well@example.com'),
30+
( 3, true, false, 'mwell@gmail.com');
31+
32+
COMMIT;
33+
34+
-- Select all email addresses that are active
35+
SELECT email FROM email_addresses
36+
WHERE active;
37+
38+
-- Select all email addresses that are active but not primary
39+
SELECT email FROM email_addresses
40+
WHERE active AND NOT primary;
2141
----
2242

23-
.Example
43+
.Result
2444
[source,sql]
2545
[subs="verbatim"]
2646
----
47+
SQL> -- Create a new table containing two boolean columns
2748
SQL> CREATE TABLE email_addresses
28-
2 (
29-
3 user_id NUMBER NOT NULL,
30-
4 email VARCHAR2(255) NOT NULL,
31-
5 active BOOLEAN NOT NULL,
32-
6 primary BOOL NOT NULL
33-
7 );
49+
(
50+
user_id NUMBER NOT NULL,
51+
email VARCHAR2(255) NOT NULL,
52+
active BOOLEAN NOT NULL,
53+
primary BOOL NOT NULL
54+
);
3455
35-
Table EMAIL_ADDRESSES created.
56+
Table created.
3657
58+
SQL> -- Insert values into the table
3759
SQL> INSERT INTO email_addresses
38-
2 (user_id, active, primary, email)
39-
3 VALUES ( 1, true, true, 'jon.doe@example.com'),
40-
4 ( 2, true, true, 'jane.smith@gmail.com'),
41-
5 ( 2, false, false, 'jsmith@gmail.com'),
42-
6 ( 3, true, true, 'max.well@example.com'),
43-
7 ( 3, true, false, 'mwell@gmail.com');
60+
(user_id, active, primary, email)
61+
VALUES ( 1, true, true, 'jon.doe@example.com'),
62+
( 2, true, true, 'jane.smith@gmail.com'),
63+
( 2, false, false, 'jsmith@gmail.com'),
64+
( 3, true, true, 'max.well@example.com'),
65+
( 3, true, false, 'mwell@gmail.com');
4466
45-
5 rows inserted.
67+
5 rows created.
4668
4769
SQL> COMMIT;
4870
4971
Commit complete.
5072
5173
SQL> -- Select all email addresses that are active
5274
SQL> SELECT email FROM email_addresses
53-
2 WHERE active;
75+
WHERE active;
5476
5577
EMAIL
56-
--------------------
78+
--------------------------------------------------------------------------------
5779
jon.doe@example.com
5880
jane.smith@gmail.com
5981
max.well@example.com
6082
mwell@gmail.com
6183

62-
SQL> -- Select all email addresses that are active and primary
84+
SQL> -- Select all email addresses that are active but not primary
6385
SQL> SELECT email FROM email_addresses
64-
2 WHERE active AND primary;
86+
WHERE active AND NOT primary;
6587

6688
EMAIL
67-
--------------------
68-
jon.doe@example.com
69-
jane.smith@gmail.com
70-
max.well@example.com
89+
--------------------------------------------------------------------------------
90+
mwell@gmail.com
7191
----
7292

7393
== Benefits
@@ -77,6 +97,6 @@ The `BOOLEAN` data type standardizes the storage of "Yes" and "No" values.
7797
== Further information
7898

7999
* Introduced: xref:versions:{database-version}/index.adoc[]
80-
* Availability: all editions
100+
* Availability: All Offerings
81101
* link:https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Data-Types.html[Documentation]
82102
* link:https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Data-Types.html[Example]

features/feature.adoctemplate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ Replace this text with the benefits the feature provides
2525
== Further information
2626

2727
* Introduced: xref:versions:{database-version}/index.adoc[]
28-
* Availability: ###Oracle Database feature edition availability, use "all editions" if it is not factored###
28+
* Availability: ###Oracle Database feature edition availability, use "All Offerings" if it is not factored###
2929
* link:###URL Link to the Doc###[Documentation]
3030
* link:###URL Link to an example###[Example]

features/identity-columns.adoc

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,30 @@ To declare a column as an identity in a table, use the `GENERATED AS IDENTITY` c
1313
[source,sql]
1414
[subs="verbatim"]
1515
----
16+
-- Create a table with the column "ID" generated as Identity column
1617
CREATE TABLE employees
1718
(
1819
id NUMBER GENERATED AS IDENTITY NOT NULL PRIMARY KEY,
1920
first_name VARCHAR2(10),
2021
last_name VARCHAR2(10) NOT NULL,
2122
job_title VARCHAR2(20) NOT NULL
2223
);
24+
25+
-- Note the absence of the "ID" column in the INSERT statement.
26+
-- Although it is a primary key and NOT NULL, the inserts succeed.
27+
INSERT INTO employees (first_name, last_name, job_title)
28+
VALUES ('Gerald', 'Venzl', 'Developer');
29+
30+
INSERT INTO employees (first_name, last_name, job_title)
31+
VALUES ('Andres', 'Almiray', 'Developer');
32+
33+
INSERT INTO employees (first_name, last_name, job_title)
34+
VALUES ('Chris', 'Saxon', 'Developer Evangelist');
35+
36+
COMMIT;
37+
38+
-- The SELECT statement will show the "ID" column with values filled by the generated identity values.
39+
SELECT * FROM employees;
2340
----
2441

2542
The identity column provides additional syntax modifiers to:
@@ -33,6 +50,7 @@ The identity column provides additional syntax modifiers to:
3350
[source,sql]
3451
[subs="verbatim"]
3552
----
53+
SQL> -- Create a table with the column "ID" generated as Identity column
3654
SQL> CREATE TABLE employees
3755
2 (
3856
3 id NUMBER GENERATED AS IDENTITY NOT NULL PRIMARY KEY,
@@ -43,25 +61,29 @@ SQL> CREATE TABLE employees
4361
4462
Table EMPLOYEES created.
4563
64+
SQL> -- Note the absence of the "ID" column in the INSERT statement.
65+
SQL> -- Although it is a primary key and NOT NULL, the inserts succeed.
66+
4667
SQL> INSERT INTO employees (first_name, last_name, job_title)
47-
2 VALUES ('Gerald', 'Venzl', 'Developer');
68+
VALUES ('Gerald', 'Venzl', 'Developer');
4869
4970
1 row inserted.
5071
5172
SQL> INSERT INTO employees (first_name, last_name, job_title)
52-
2 VALUES ('Andres', 'Almiray', 'Developer');
73+
VALUES ('Andres', 'Almiray', 'Developer');
5374
5475
1 row inserted.
5576
5677
SQL> INSERT INTO employees (first_name, last_name, job_title)
57-
2 VALUES ('Chris', 'Saxon', 'Developer Evangelist');
78+
VALUES ('Chris', 'Saxon', 'Developer Evangelist');
5879
5980
1 row inserted.
6081
6182
SQL> COMMIT;
6283
6384
Commit complete.
6485
86+
SQL> -- The SELECT statement will show the "ID" column with values filled by the generated identity values.
6587
SQL> SELECT * FROM employees;
6688
6789
ID FIRST_NAME LAST_NAME JOB_TITLE
@@ -82,6 +104,6 @@ Identity columns ensure that the value for a new row will always be unique by us
82104
== Further information
83105

84106
* Introduced: xref:versions:{database-version}/index.adoc[]
85-
* Availability: all editions
107+
* Availability: All Offerings
86108
* link:https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-TABLE.html#GUID-F9CE0CC3-13AE-4744-A43C-EAC7A71AAAB6__CJAECCFH[Documentation - CREATE TABLE identity_clause]
87109
* link:https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-TABLE.html#GUID-F9CE0CC3-13AE-4744-A43C-EAC7A71AAAB6__CJAHCAFF[Example]

features/plsql-function-in-sql.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ but the user does either not have the necessary privileges to create a named fun
9595
== Further information
9696

9797
* Introduced: xref:versions:{database-version}/index.adoc[]
98-
* Availability: all editions
98+
* Availability: All Offerings
9999
* link:https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html#GUID-CFA006CA-6FF1-4972-821E-6996142A51C6__BABFAFID[Documentation]
100100
* link:https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html#GUID-CFA006CA-6FF1-4972-821E-6996142A51C6__BABJFIDC[Example]

0 commit comments

Comments
 (0)