-
-
Notifications
You must be signed in to change notification settings - Fork 873
Add support for Oracle PL/SQL (Procedures, Functions, Packages, Triggers, Types, Cursors, Loops) #6635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-else statements and create procedure statements.
…pe reference and fix edges for merge and insert statements in Oracle.
…cks with declare statements in Oracle.
…GER` statements in Oracle.
…R` statements in Oracle.
…pport for `WHILE LOOP`, `OPEN` and `CONTINUE` statements in Oracle.
… `DROP TYPE` statements in Oracle.
Coverage Results ✅
|
…ype of class `CreateTriggerStatementSegment` to `create_trigger_statement`.
OneOf("IS", "AS", optional=True), | ||
AnyNumberOf(Ref("DeclareSegment"), optional=True), | ||
Ref("BeginEndSegment", optional=True), | ||
Ref("DelimiterGrammar", optional=True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need to be kept, because procedures can be declared inside DeclareSegment
and CreatePackageStatementSegment
. If I remove it the parser raises an error.
Dedent, | ||
"END", | ||
Ref("ObjectReferenceSegment", optional=True), | ||
Ref("DelimiterGrammar", optional=True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about this one - is it a statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a statement, it's an anonymous block. Oracle don't define it as a statement.
Removed the DelimiterGrammar
.
OneOf("IS", "AS", optional=True), | ||
AnyNumberOf(Ref("DeclareSegment"), optional=True), | ||
Ref("BeginEndSegment", optional=True), | ||
Ref("DelimiterGrammar", optional=True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need to be kept, because functions can be declared inside DeclareSegment
and CreatePackageStatementSegment
. If I remove it the parser raises an error.
"BEGIN", | ||
Ref("OneOrMoreStatementsGrammar"), | ||
Sequence("END", Ref("TimingPointGrammar")), | ||
Ref("DelimiterGrammar"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need a delimiter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it does, because it's part of the trigger block. If I remove this delimiter the parser thinks it's the end of the trigger and raises an error.
Nearly there, just one final merge conflict |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is quite a big one.
It adds support for Oracle PL/SQL objects like Procedures, Functions, Types, Packages, Anonymous Blocks, If statements, Case statements, Loops, Cursors and Collections.
Some objects were copied from T-SQL dialect.
The tests statements were copied from the official Oracle PL/SQL Documentation
Closes #1217.
Closes #6568.
Brief summary of the change made
Are there any other side effects of this change that we should be aware of?
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.