-
Notifications
You must be signed in to change notification settings - Fork 2
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
[DBMON-3057] create Oracle test suite #26
Conversation
"input": "DECLARE TYPE EmpTabTyp IS TABLE OF employees%ROWTYPE INDEX BY PLS_INTEGER; emp_tab EmpTabTyp; BEGIN SELECT * BULK COLLECT INTO emp_tab FROM employees; FORALL i IN emp_tab.FIRST .. emp_tab.LAST SAVE EXCEPTIONS UPDATE employees SET test = test * 1.05 WHERE employee_id = emp_tab(i).employee_id; END;", | ||
"outputs": [ | ||
{ | ||
"expected": "DECLARE TYPE EmpTabTyp IS TABLE OF employees % ROWTYPE INDEX BY PLS_INTEGER; emp_tab EmpTabTyp; BEGIN SELECT * BULK COLLECT INTO emp_tab FROM employees; FORALL i IN emp_tab.FIRST . . emp_tab.LAST SAVE EXCEPTIONS UPDATE employees SET test = test * ? WHERE employee_id = emp_tab ( i ) . employee_id; END", |
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.
It would be correct to keep ;
in the end. The program wouldn't execute otherwise.
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.
updated. the trailing semicolon is controlled by KeepTrailingSemicolon
and disabled by default.
"input": "DELETE FROM orders o WHERE o.customer_id IN (SELECT c.id FROM customers c WHERE NOT EXISTS (SELECT 1 FROM customer_orders co WHERE co.customer_id = c.id AND co.order_date > SYSDATE - 365)) AND EXISTS (SELECT 1 FROM order_items oi WHERE oi.order_id = o.id AND oi.product_id IN (SELECT p.id FROM products p WHERE p.category = 'Obsolete'));", | ||
"outputs": [ | ||
{ | ||
"expected": "DELETE FROM orders o WHERE o.customer_id IN ( SELECT c.id FROM customers c WHERE NOT EXISTS ( SELECT ? FROM customer_orders co WHERE co.customer_id = c.id AND co.order_date > SYSDATE - ? ) ) AND EXISTS ( SELECT ? FROM order_items oi WHERE oi.order_id = o.id AND oi.product_id IN ( SELECT p.id FROM products p WHERE p.category = ? ) )", |
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.
Do we want to add space before and after parentheses?
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.
It's controlled by normalizer option RemoveSpaceBetweenParentheses
. By default it's disabled and spaces will be added. I do have add test cases to make sure this config option works as expected, for example
"remove_space_between_parentheses": true |
@@ -0,0 +1,27 @@ | |||
{ |
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.
Alternatively, the procedure can be invoked with the key word EXEC
instead of embedding it winto BEGIN
END
block.
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.
new test case invoke-stored-procedure-with-exec added
This PR creates test suite for
Oracle
DBMS. Similar as the Postgres PR, the goal is to have a comprehensive list of Oracle specific SQL statements that we can leverage to verify the completeness and correctness of the package.Highlight some test cases to very several Oracle-specific syntax and features:
START WITH ... CONNECT BY clause
AS OF clauses
DECODE
,NVL
,DBMS_OUTPUT.PUT_LINE
,SYS_REFCURSOR
,RAISE_APPLICATION_ERROR
, and the use of sequences likeNEXTVAL
andCURRVAL
.BULK COLLECT
andFORALL
ROW_NUMBER
,RANK
,DENSE_RANK
, etc.RAISE
andRAISE_APPLICATION_ERROR
.