Search code examples
oracle-databaseplsqlliquibase

Encountered the symbol end of file error while Pl/SQL execution


PL/SQL with Error log

I am running a very simple Declare begin end statement but it's throwing the above error. Even though the pl/sql works perfectly if I run it in sql developer. But when I put it inside my liquibase project it gives the error PLS-00103: Encountered the symbol "end-of-file" ..

I tried removing the last semicolon and putting a slash / at the end. But the error still remains. I am not sure if there is something in liquibase settings that needs to be done to run the declare begin blocks

Things tried:
I tried putting NULL and still the same error.
null inside begin

Error with empty Declare:
empty declare block

The following worked:
<sqlFile endDelimiter="/"


Solution

  • It's throwing the error because there is nothing between BEGIN and END. In a pl/sql block, that is where the magic happens. A statement is expected between BEGIN and END. If you really want nothing to happen (like you: you're going to finish your code later and you just want to check if it runs with what you have in the DECLARE section) then you can use the pl/sql statement that does nothing: NULL;. Try the following:

    DECLARE
    BEGIN 
      NULL;
    END;
    /
    
    PL/SQL procedure successfully completed.
    

    A good place to start is the documentation.