A question that comes up fairly frequently revolves around how to see your errors when working with PL/SQL in SQL Developer.

Most folks are probably working in the worksheet – this is the default editor for your connection.

Let’s take a look at this sample program

CREATE OR REPLACE PROCEDURE do_nothing IS
BEGIN
 dbms_output.put(sysdate);
 this should probably error OUT, RIGHT?
 NULL;
END;
/

If we were to create this procedure, we would probably expect some errors. So let’s run this in the Worksheet. I’m using Ctrl+Enter to execute this single statement.

I have warnings, oh no!

Ok, but how do I see the errors?

This is the worksheet. The commands run here will run very similar to how they would run in SQL*Plus. So knowing this, if we change-up the process a little bit, we can start to get better feedback from SQL Developer.

Add ‘show errors’ after the create or replace, and use F5 instead of Ctrl+Enter. This will run the entire script, and ask Oracle to show us any errors for the session.

A little better, but not as good as it gets

You might be wondering why the line number is off. Oracle reports back a problem on line #4. If you’ll notice our program starts on SQL Developer worksheet line #2, but Oracle database only receives the actual statement, so you can do the math here to figure out the actual problem lies on line #5.

Viewing Errors in the Explorer

The current errors for the objects can also be viewed in the database explorer. Navigate to the object and open the ‘Errors’ panel.

Viewing Errors in the Explorer

Working in the Procedure Editor

As the name implies, the Procedure Editor is for developing and debugging your PL/SQL code. The full power of the IDE is realized here. Ok, so how do you get started with a Procedure Editor instead of a Worksheet?

In the object explorer, right-click on ‘Procedures’ and select ‘New Procedure.’ This will open a new Procedure Editor with the default procedure template code. Now when you compile, you’ll get much better error display support.

Just in case you've never seen a PL/SQL Error, Here's One

If you have a large program with several errors you can use the right gutter scroll bar area to scan for errors (denoted in red), then mouse-over to get the error message text. If you are looking at the feedback in the ‘Compiler’ panel below, you can double-click on an error message. This will move your cursor to the linenumber, curpos.

If you are working on a large script with multiple PL/SQL objects, I recommend using the Procedure Editor to perfect your procedure code, then copying that code back to your script and running that in the worksheet. Just don’t forget to add the ‘SHOW ERRORS’ line at the end.

Disclaimer: This post was written with Oracle SQL Developer v3.1.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

6 Comments

  1. Hey Jeff,

    How can I view more than 20 errors in SQL Developer?
    I keep getting this error that says:

    Warning(1,1): Only first 20 issues are reported

    • The first error is the most important, error 21 – not so much. Esp if you fix error #1 and the rest go away, yes?

      I’m guess you’re seeing this on compiles – you can see the entire error report on the Errors page of your code object.

  2. I may have found my original issue (after upgrading today to 3.1.0.7)
    Nothing happens with “sho err”, but “show err” or “show errors” does work ok.

    • JeffS

      In 11.2.0.3, using ‘sho err’ in SQL*Plus does not work

      SQL> create or replace procedure x is
      2 begin
      3 dbms_output.put_line(x);
      4 null
      5 end procedure x;
      6
      7 sho err
      8 /

      Warning: Procedure created with compilation errors.

      But show err does

      ERROR at line 4:
      ORA-06550: line 4, column 1:
      PLS-00103: Encountered the symbol “END” when expecting one of the following:
      ;

  3. Noting the Oracle Sql Developer v3.1 disclaimer, might that explain why “sho err” didn’t respond to F5 – run as script (instead of run as statement)? I currently have 3.0.04

    Thanks for this informative & concise post!

    • JeffS

      So I tried the same code in v3.0.0.4, and I see the same behavior in the worksheet as I see in v3.1EA3. The error appears in the Script Output panel.

      PROCEDURE do_nothing compiled
      Warning: execution completed with warning
      4/7 PLS-00103: Encountered the symbol “SHOULD” when expecting one of the following:

      := . ( @ % ;

Write A Comment