Skip to content

[FEATURE] missing feature on parsing PL/SQL with "DECLARE" cluase #1786

Closed

Description

@ZhengguanLi

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

Activity

  1. manticore-projects commented on May 15, 2023

    @manticore-projects
    Contributor

    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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions