- Empty input returns no segments.
- Whitespace-only input returns no segments.
- Comment-only input returns no segments.
- A single semicolon-terminated SQL statement returns one segment without the delimiter.
- A single SQL statement without a semicolon returns one segment.
- Multiple semicolon-terminated SQL statements return separate segments.
- Mixed terminated and unterminated SQL statements return separate segments.
- Consecutive semicolons do not produce empty segments.
- Leading whitespace before SQL is preserved in segment text and range.
- Inter-statement whitespace is attached to the following segment unless it is consumed as a SQL*Plus line-command delimiter.
- Trailing whitespace after the final statement is preserved in the final segment.
- CRLF line endings do not corrupt boundaries.
- UTF-8 comments do not corrupt byte ranges.
- Arithmetic division does not act as a slash delimiter.
- Schema-qualified and dblink-qualified names do not affect splitting.
- Semicolons inside single-quoted string literals are ignored.
- Slashes inside single-quoted string literals are ignored.
- Escaped single quotes using doubled quotes are handled.
- National character literals
N'...'are handled. - Oracle
q'[ ... ]'quoting is handled. - Oracle
q'{ ... }'quoting is handled. - Oracle
q'( ... )'quoting is handled. - Oracle
q'< ... >'quoting is handled. - Oracle custom
q'!...!'quoting is handled. - Semicolons inside double-quoted identifiers are ignored.
- Slashes inside double-quoted identifiers are ignored.
- Line comments containing semicolons are ignored.
- Line comments containing slash-only visual markers are ignored.
- Block comments containing semicolons are ignored.
- Block comments containing slash-only lines are ignored.
- Nested block comments are handled.
- Hints
/*+ ... */containing delimiters are ignored for splitting.
- A slash alone on a line flushes the current SQL segment.
- A slash line with surrounding horizontal whitespace flushes the current SQL segment.
- A slash at EOF flushes the current SQL segment.
- A slash followed by non-whitespace on the same line is not a delimiter.
- A slash preceded by non-whitespace on the same line is not a delimiter.
-
RUNalone on a line flushes the current SQL segment. -
Ralone on a line flushes the current SQL segment. - Slash commands with leading command lines before SQL do not produce empty segments.
- Multiple slash commands in a row do not produce empty segments.
- Slash commands after PL/SQL units do not appear in segment text.
-
BEGIN ... END;is returned as one segment. -
DECLARE ... BEGIN ... END;is returned as one segment. - Labeled anonymous blocks are returned as one segment.
- Nested anonymous blocks do not split at inner semicolons.
- Exception handlers do not split the outer block.
-
IF ... END IF;stays inside the block. -
CASE ... END CASE;stays inside the block. -
LOOP ... END LOOP;stays inside the block. -
WHILE ... LOOP ... END LOOP;stays inside the block. -
FOR ... LOOP ... END LOOP;stays inside the block. -
FORALLstatements stay inside the block. - Dynamic SQL strings containing semicolons stay inside the block.
-
CREATE PROCEDURE ... END; /is one segment. -
CREATE OR REPLACE PROCEDURE ... END; /is one segment. -
CREATE EDITIONABLE PROCEDURE ... END; /is one segment. -
CREATE NONEDITIONABLE PROCEDURE ... END; /is one segment. -
CREATE FUNCTION ... END; /is one segment. - Function bodies with arithmetic division do not split at
/. -
CREATE PACKAGE ... END; /is one segment. -
CREATE PACKAGE BODY ... END; /is one segment. - Package body nested procedure bodies do not terminate the package.
- Package body nested function bodies do not terminate the package.
-
CREATE TRIGGER ... BEGIN ... END; /is one segment. - Compound triggers are one segment.
-
CREATE TYPE BODY ... END; /is one segment. - Type body member function bodies do not terminate the type body.
- Stored units followed by ordinary SQL split correctly.
-
SETcommand lines are returned as line segments. -
SHOWcommand lines are returned as line segments. -
PROMPTcommand lines are returned as line segments, including embedded semicolons. -
SPOOLcommand lines are returned as line segments. -
COLUMNcommand lines are returned as line segments. -
BREAKcommand lines are returned as line segments. -
COMPUTEcommand lines are returned as line segments. -
TTITLEandBTITLEcommand lines are returned as line segments. -
REPHEADERandREPFOOTERcommand lines are returned as line segments. -
DEFINEandUNDEFINEcommand lines are returned as line segments. -
ACCEPTcommand lines are returned as line segments. -
VARIABLEandPRINTcommand lines are returned as line segments. -
EXECUTEcommand lines are returned as line segments. -
CONNECTandDISCONNECTcommand lines are returned as line segments. -
EXITandQUITcommand lines are returned as line segments. -
WHENEVER SQLERRORcommand lines are returned as line segments. -
WHENEVER OSERRORcommand lines are returned as line segments. -
@,@@, andSTARTscript invocation lines are returned as line segments. -
REMandREMARKcommand lines are returned as line segments. -
HOSTand!shell command lines are returned as line segments. - Buffer manipulation commands
LIST,APPEND,CHANGE,DEL,INPUT,SAVE,GET, andEDITare returned as line segments. - SQL*Plus command words inside SQL are not treated as line commands.
- SQL*Plus command words inside PL/SQL are not treated as line commands.
- Unterminated single-quoted strings do not panic.
- Unterminated q-quotes do not panic.
- Unterminated double-quoted identifiers do not panic.
- Unterminated block comments do not panic.
- Missing PL/SQL
ENDreturns a best-effort trailing segment. - Truncated
CREATE PROCEDUREreturns a best-effort trailing segment. - Binary-ish bytes do not panic.
- Every returned segment has a valid non-overlapping byte range.
- Every returned segment text equals
input[ByteStart:ByteEnd]. - Reconstructing returned ranges includes SQL*Plus command lines as their own segments.
-
oracle.Parseparses splitter output from ordinary SQL scripts. -
oracle.Parseparses splitter output from slash-terminated PL/SQL scripts. -
oracle.Parsereturns parser errors for SQL*Plus command segments instead of silently skipping them. -
oracle.Parsepreserves original byte offsets in AST locations. -
oracle.Parsereports start line and column based on the original script. -
oracle.Parsehandles multiple ordinary SQL statements around slash-delimited PL/SQL blocks.