Skip to content

Commit

Permalink
Add alternative Oracle constraint syntax (#4139)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros authored Jun 17, 2024
1 parent 553c44f commit 086ca96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sql/plsql/PlSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ function_body
| invoker_rights_clause
| parallel_enable_clause
| result_cache_clause
| streaming_clause
| streaming_clause
// see example in section "How Table Functions Stream their Input Data" on streaming_clause in Oracle 9i: https://docs.oracle.com/cd/B10501_01/appdev.920/a96624/08_subs.htm#20554
)* (
( (IS | AS) (DECLARE? seq_of_declare_specs? body | call_spec))
Expand Down Expand Up @@ -2777,7 +2777,7 @@ out_of_line_ref_constraint

out_of_line_constraint
: (
(CONSTRAINT constraint_name)? (
((CONSTRAINT | CONSTRAINTS) constraint_name)? (
UNIQUE '(' column_name (',' column_name)* ')'
| PRIMARY KEY '(' column_name (',' column_name)* ')'
| foreign_key_clause
Expand Down
8 changes: 8 additions & 0 deletions sql/plsql/examples/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ CREATE TABLE tab (ID number(9) primary key, data xmltype, data2 xmltype) NO MEMO

CREATE TABLE tab IF NOT EXISTS (ID number(9) primary key);

CREATE TABLE T1 (
"NAME" VARCHAR(10) NOT NULL,
"ID" INT NOT NULL,
"ADDRESS" VARCHAR(255),
"SQ_NUMBER" NUMBER(10),
"PQ_NUMBER" NUMBER(10),
CONSTRAINTS UQ1 UNIQUE ("SQ_NUMBER", "PQ_NUMBER"));

create TABLE PROCESSED AS (
select * FROM T_ORDER_PROCESSED f)
-- WHERE
Expand Down

0 comments on commit 086ca96

Please sign in to comment.