Skip to content
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

Split does not work properly #692

Open
corncat-liu opened this issue Nov 27, 2022 · 1 comment
Open

Split does not work properly #692

corncat-liu opened this issue Nov 27, 2022 · 1 comment
Labels

Comments

@corncat-liu
Copy link

The split does not work properly for the below Oracle Stored procedure

CREATE OR REPLACE EDITIONABLE PROCEDURE "OWB_ADMIN"."AZBJ_RI_LIMIT_PROC"
AS
week_date_first DATE := TRUNC (azbj_pme_api.opus_date - 7);
week_date_last DATE := TRUNC (azbj_pme_api.opus_date - 1);
BEGIN
logtrace ('LOG',
10001,
'PROC AZBJ_RI_LIMIT_PROC STARTED',
'AZBJ_RI_LIMIT_PROC');
BEGIN
EXECUTE IMMEDIATE ('DROP TABLE STG_RI_LIMIT_DATA PURGE');
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
END;

Screen Shot 2022-11-26 at 8 33 56 PM

@andialbrecht andialbrecht added this to the 0.4.4 milestone Dec 30, 2022
@andialbrecht
Copy link
Owner

Here's a simplified version of the same bug taken from the Oracle reference:

>>> sql = """CREATE PROCEDURE remove_emp (employee_id NUMBER) AS
...    tot_emps NUMBER;
...    BEGIN
...       DELETE FROM employees
...       WHERE employees.employee_id = remove_emp.employee_id;
...    tot_emps := tot_emps - 1;
...    END;"""
>>>
>>> len(sqlparse.split(sql))
4
>>> sqlparse.split(sql)
['CREATE PROCEDURE remove_emp (employee_id NUMBER) AS\n   tot_emps NUMBER;',
 'BEGIN\n      DELETE FROM employees\n      WHERE employees.employee_id = remove_emp.employee_id;',
 'tot_emps := tot_emps - 1;',
 'END;']
>>>

@andialbrecht andialbrecht modified the milestones: 0.4.4, 0.4.5 Mar 20, 2023
@andialbrecht andialbrecht modified the milestones: 0.4.5, 0.5.0 Aug 6, 2023
@andialbrecht andialbrecht removed this from the 0.5.0 milestone Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants