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

Improve oracle schema statistics #6252

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ZhengguanLi
Copy link
Contributor

@ZhengguanLi ZhengguanLi commented Nov 26, 2024

Changes:

  • Avoid the following cases where invalid columns are added in schema statistics
    • Oracle PL/SQL implicit cursors
      • IF SQL%FOUND, IF SQL%NOTFOUND etc...
    • Oracle exception in when clause:
      • WHEN NO_DATA_FOUND, WHEN TOO_MANY_ROWS etc
      • Custom exceptions
    • Oracle PL/SQL declared variables

// skip
} else {
this.visit(ident);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid treating the exception name as a column

@@ -528,8 +580,7 @@ public boolean visit(OracleExecuteImmediateStatement x) {
SQLExpr valueExpr = null;
if (x.getParent() instanceof SQLBlockStatement) {
List<SQLStatement> statementList = ((SQLBlockStatement) x.getParent()).getStatementList();
for (int i = 0, size = statementList.size(); i < size; ++i) {
SQLStatement stmt = statementList.get(i);
for (SQLStatement stmt : statementList) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to enhanced for loop

@@ -861,8 +861,6 @@ public DbType getDbType() {
}

protected Column getColumn(SQLExpr expr) {
final SQLExpr original = expr;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up unused variable

@@ -357,7 +357,7 @@ public static long hashCode64(String owner, String name) {
return hashCode;
}

public static interface Constants {
public interface Constants {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inner interface does not need to be static(IDE warning)

" ELSE" +
" DBMS_OUTPUT.PUT_LINE ('No department number ' || dept_no);" +
" DBMS_OUTPUT.PUT_LINE ('No department number');" +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix SQL syntax: dept_no is not a declared variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant