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

False negative in G-9501 when using constant #55

Closed
PhilippSalvisberg opened this issue Dec 8, 2022 · 0 comments · Fixed by #59
Closed

False negative in G-9501 when using constant #55

PhilippSalvisberg opened this issue Dec 8, 2022 · 0 comments · Fixed by #59
Assignees
Labels
bug Something isn't working

Comments

@PhilippSalvisberg
Copy link
Collaborator

The following code violates the rule "G-9501: Never use parameter in string expression of dynamic SQL. Use asserted local variable instead.". But no violation is detected

create or replace procedure exec_sql(in_sql in varchar2) is
   co_sql constant varchar2(1000 char) := in_sql;
begin
   execute immediate co_sql;
end exec_sql;
/

This code detects a violation.

create or replace procedure exec_sql(in_sql in varchar2) is
   l_sql varchar2(1000 char) := in_sql;
begin
   execute immediate l_sql;
end exec_sql;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant