fix(sql): handle nested GaussDB procedure blocks

This commit is contained in:
zipg authored and GitHub committed 2026-07-24 09:29:49 +08:00
1 parent 2336af413d
commit 0b2f5cc1ba
2 files changed
+21 -2

No files matched your search

@@ -1669,14 +1669,15 @@ function oraclePlSqlBlockIsComplete(sql: string): boolean {
if (token.kind !== "word") continue;
if (token.value === "DECLARE") {
stack.push("BLOCK");
stack.push("DECLARATION");
continue;
}
if (token.value === "BEGIN") {
if (tokens[index - 1]?.kind === "word" && tokens[index - 1]?.value === "TRANSACTION") continue;
const previous = previousWordToken(tokens, index);
if (previous === "END") continue;
if (stack[stack.length - 1] !== "BLOCK") stack.push("BLOCK");
if (stack[stack.length - 1] === "DECLARATION") stack[stack.length - 1] = "BLOCK";
else stack.push("BLOCK");
continue;
}
if (token.value === "IF") {