JSqlParser
JSqlParser copied to clipboard
[FEATURE] missing feature on parsing PL/SQL with "DECLARE" cluase
Grammar or Syntax Description
DECLARE clause is not supported yet
SQL Example
- Simplified Query Example, focusing on the failing feature
DECLARE num NUMBER; BEGIN num := 10; dbms_output.put_line('The number is ' || num); END; - Exception
net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "num" <S_IDENTIFIER> at line 2, column 4. Was expecting one of: "@" "@@"
Additional context
The used JSQLParser Version: 4.6 State the applicable RDBMS and version: Oracle 19c Links to the reference documentation: N/A
Greetings.
Those blocks exceed normal SQL Standard and can become very complex. See the example below. You will need to provide or sponsor an implementation to get those blocks supported. It will be some serious work.
DECLARE
l_message
VARCHAR2 (100) := 'Hello';
BEGIN
DECLARE
l_message2 VARCHAR2 (100) :=
l_message || ' World!';
BEGIN
DBMS_OUTPUT.put_line (l_message2);
END;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
(DBMS_UTILITY.format_error_stack);
END;