EXCEPTION WHEN OTHERS THEN
Catches all errors
Filling your code with this without reraising the error hides unexpected issues
So the compiler raises PLW-6009 to warn you
If you reraise in custom logging procedures use
PRAGMA SUPPRESSES_WARNING_6009
To skip this warning
EXCEPTION WHEN OTHERS THEN
Catches all errors
Filling your code with this without reraising the error hides unexpected issues
So the compiler raises PLW-6009 to warn you
If you reraise in custom logging procedures use
PRAGMA SUPPRESSES_WARNING_6009
To skip this warning
This browser-based tool enables you to run and share #SQL statements
Even better, you can now connect to your schema from clients on your machine using SQL*Net
So you can run SQL from your favourite IDE
This browser-based tool enables you to run and share #SQL statements
Even better, you can now connect to your schema from clients on your machine using SQL*Net
So you can run SQL from your favourite IDE
At parse time the database merges these with the parent query, replacing parameters with the actual values passed
Macros come in two types
Scalar - use in SELECT, WHERE, ORDER BY, etc.
Table - use in FROM
At parse time the database merges these with the parent query, replacing parameters with the actual values passed
Macros come in two types
Scalar - use in SELECT, WHERE, ORDER BY, etc.
Table - use in FROM
This adds a GRAPHQL table function that
Accepts #GraphQL queries
Maps fields to database tables and columns
Returns JSON
e.g.
SELECT * FROM GRAPHQL ( ' tab { col1 col2 } ' )
This adds a GRAPHQL table function that
Accepts #GraphQL queries
Maps fields to database tables and columns
Returns JSON
e.g.
SELECT * FROM GRAPHQL ( ' tab { col1 col2 } ' )
This adds the QUALIFY clause
QUALIFY filters window functions after grouping
Like the HAVING clause does for aggregate functions
SELECT ... FROM ...
QUALIFY fn OVER ( ... ) > ...
This adds the QUALIFY clause
QUALIFY filters window functions after grouping
Like the HAVING clause does for aggregate functions
SELECT ... FROM ...
QUALIFY fn OVER ( ... ) > ...
You can use ANY_VALUE, e.g.:
SELECT c1, ANY_VALUE ( c2 ), COUNT ...
FROM ...
GROUP BY c1
This returns the value from a random row (it's optimized to return the first) => non-deterministic
You can use ANY_VALUE, e.g.:
SELECT c1, ANY_VALUE ( c2 ), COUNT ...
FROM ...
GROUP BY c1
This returns the value from a random row (it's optimized to return the first) => non-deterministic
ORDER BY ... [ frame ] ... PRECEDING
The frame states which sort keys to include (UNBOUNDED = all)
ROWS - Strict row count
RANGE - Logical value offset; only valid for numbers & datetimes
GROUPS - Unique values count
ORDER BY ... [ frame ] ... PRECEDING
The frame states which sort keys to include (UNBOUNDED = all)
ROWS - Strict row count
RANGE - Logical value offset; only valid for numbers & datetimes
GROUPS - Unique values count
Custom increments (BY)
Lists of values to loop through
Conditions to skip the loop body (WHEN)
Expressions to set the next value (REPEAT WHILE)
Mutable iterands to set their value inside the loop (MUTABLE)
Custom increments (BY)
Lists of values to loop through
Conditions to skip the loop body (WHEN)
Expressions to set the next value (REPEAT WHILE)
Mutable iterands to set their value inside the loop (MUTABLE)
ADD_MONTHS ( dt, -12 )
- INTERVAL '1' YEAR
But take care - these handle 29th Feb differently:
ADD_MONTHS => 29th Feb -> 28th Feb in previous year
INTERVAL => 29th Feb -> 29th Feb in previous year => error!
ADD_MONTHS ( dt, -12 )
- INTERVAL '1' YEAR
But take care - these handle 29th Feb differently:
ADD_MONTHS => 29th Feb -> 28th Feb in previous year
INTERVAL => 29th Feb -> 29th Feb in previous year => error!
CREATE MULTIVALUE INDEX ... ON t ( t.json_data.array.
The optimizer can use these indexes when searching the array with
JSON_EXISTS ( t.json_data, ' $.array? ( @.
CREATE MULTIVALUE INDEX ... ON t ( t.json_data.array.
The optimizer can use these indexes when searching the array with
JSON_EXISTS ( t.json_data, ' $.array? ( @.
FIRST_VALUE => inital
NTH_VALUE => Nth
LAST_VALUE => final
The default window ends at the current value =>
NTH_VALUE ( v, N ) is null for rows before N
LAST_VALUE gives the final value with the same sort key, not the very last row
FIRST_VALUE => inital
NTH_VALUE => Nth
LAST_VALUE => final
The default window ends at the current value =>
NTH_VALUE ( v, N ) is null for rows before N
LAST_VALUE gives the final value with the same sort key, not the very last row
Non-positional INSERT
GROUP BY ALL
TIME_BUCKET function
But how do you find these?
In the New Features Guides!
Some need you to up COMPATIBLE - @mikedietrichde.com the impact this has
buff.ly/5i5aPnu
Non-positional INSERT
GROUP BY ALL
TIME_BUCKET function
But how do you find these?
In the New Features Guides!
Some need you to up COMPATIBLE - @mikedietrichde.com the impact this has
buff.ly/5i5aPnu
CREATE BLOCKCHAIN TABLE ... ( ... )
NO DROP UNTIL n DAYS IDLE
NO DELETE UNTIL n DAYS AFTER INSERT
HASHING USING SHA2_512 VERSION "v1"
These
Allow INSERT
Disallow UPDATE
Disallow DELETE/DROP until you wait N days as defined
CREATE BLOCKCHAIN TABLE ... ( ... )
NO DROP UNTIL n DAYS IDLE
NO DELETE UNTIL n DAYS AFTER INSERT
HASHING USING SHA2_512 VERSION "v1"
These
Allow INSERT
Disallow UPDATE
Disallow DELETE/DROP until you wait N days as defined
GROUP BY col
And this returns one row for each value in col
You can then use aggregate functions to get totals for the rows in each group, e.g.
COUNT - number of rows
AVG - numeric mean
MIN/MAX - smallest/largest
LISTAGG - list of values
GROUP BY col
And this returns one row for each value in col
You can then use aggregate functions to get totals for the rows in each group, e.g.
COUNT - number of rows
AVG - numeric mean
MIN/MAX - smallest/largest
LISTAGG - list of values
Tables
Columns
Indexes
(Materialized) Views
With the clause
ANNOTATIONS ( <key1> <value1>, <key2> <value2>, ... )
Added in release 23ai, this has been backported to 19.28
Tables
Columns
Indexes
(Materialized) Views
With the clause
ANNOTATIONS ( <key1> <value1>, <key2> <value2>, ... )
Added in release 23ai, this has been backported to 19.28
e.g. the right table in a LEFT OUTER JOIN
Do this in the WHERE clause => it's an INNER JOIN
To preserve the OUTER JOIN, filter the inner table in the ON clause
The pic shows outer joins ON number col with inner filters
e.g. the right table in a LEFT OUTER JOIN
Do this in the WHERE clause => it's an INNER JOIN
To preserve the OUTER JOIN, filter the inner table in the ON clause
The pic shows outer joins ON number col with inner filters
LISTAGG ( DISTINCT val, ', ' ) WITHIN GROUP ( ORDER BY ... )
LISTAGG was introduced in 11g Release 2
The DISTINCT clause was added in 19c
LISTAGG ( DISTINCT val, ', ' ) WITHIN GROUP ( ORDER BY ... )
LISTAGG was introduced in 11g Release 2
The DISTINCT clause was added in 19c
FETCH FIRST n ROWS ONLY
You can include all rows with the same sort value as the Nth with
FETCH FIRST n ROWS WITH TIES
Or get a fraction of the rows with
FETCH FIRST n PERCENT ROWS [ ONLY | WITH TIES ]
FETCH FIRST n ROWS ONLY
You can include all rows with the same sort value as the Nth with
FETCH FIRST n ROWS WITH TIES
Or get a fraction of the rows with
FETCH FIRST n PERCENT ROWS [ ONLY | WITH TIES ]
Where
LAG - previous
LEAD - next
By default these look one row forward/back
Use the second parameter to get the value from N rows before/after the current
Where
LAG - previous
LEAD - next
By default these look one row forward/back
Use the second parameter to get the value from N rows before/after the current
ROW_NUMBER => Consecutive integers starting at one
RANK => Rows with the same sort value have the same number; the next row after ties has the same value as ROW_NUMBER
DENSE_RANK => Like RANK, but numbers are consecutive after ties
ROW_NUMBER => Consecutive integers starting at one
RANK => Rows with the same sort value have the same number; the next row after ties has the same value as ROW_NUMBER
DENSE_RANK => Like RANK, but numbers are consecutive after ties
SQuizL - complete the statement using the clues provided
Speed SQL - race against the clock to guess the missing keywords
Weekly DB - a new multiple-choice question every week
buff.ly/05p9QME
SQuizL - complete the statement using the clues provided
Speed SQL - race against the clock to guess the missing keywords
Weekly DB - a new multiple-choice question every week
buff.ly/05p9QME
Only units with a name in the list can call the unit
e.g.:
PROCEDURE prc ACCESSIBLE BY ( another_proc, some_fn )
Can only be run via units named ANOTHER_PROC or SOME_FN
This can give fine-grained access to package units
Only units with a name in the list can call the unit
e.g.:
PROCEDURE prc ACCESSIBLE BY ( another_proc, some_fn )
Can only be run via units named ANOTHER_PROC or SOME_FN
This can give fine-grained access to package units
Numbers => numeric type
Datetimes => date/timestamp type
Using the wrong data type leads to implicit type conversions which can:
Prevent index use => slow SQL
Be invalid => runtime errors
Choose wisely!
Numbers => numeric type
Datetimes => date/timestamp type
Using the wrong data type leads to implicit type conversions which can:
Prevent index use => slow SQL
Be invalid => runtime errors
Choose wisely!
This splits the rows into groups for each partitioning value
Then gets the running total within each group. By default, this is rows with a sort value less than or equal to the group's current row
This splits the rows into groups for each partitioning value
Then gets the running total within each group. By default, this is rows with a sort value less than or equal to the group's current row
The function then returns the running total with the window
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
This includes all rows with a sort value less than or equal to the current row's value
The function then returns the running total with the window
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
This includes all rows with a sort value less than or equal to the current row's value