0

I'm using SQL Developer Version 17.2.0.188. When I compile code, which cause some error, e.g. begin raise_application_error(-20001, 'xxxxx'); end;

I see the error message in script outputs(like dbms_output), but i would like to see it in a new window, similar when you declare some bind variable: variable_name number := &value; Could somebody tell me where in SQL Developer can I change the seetings to make this window visible?

I don't have option in this version of SQL developer: Tools -> Preferences -> User Interface -> Options -> DSA Dialogs...

Best regards, Derk.

Derk
  • 1
  • 1
  • 2
  • Have you searched it at all? – Ibo Apr 03 '18 at 17:40
  • "but i would like to see it in a new window, similar when you declare some bind variable:" - you want a pop up dialog with the error text? – thatjeffsmith Apr 03 '18 at 17:43
  • Exactly. It is going about pop up. Of course, I searched but i haven't find solution. – Derk Apr 03 '18 at 17:58
  • Unlikely i don't have the option "User Interface" in this version of sql developer. – Derk Apr 03 '18 at 18:12
  • @BarbarosÖzhan: that question relates to Allround Automations' PL/SQL Developer, this question relates to Oracle SQL Developer. – Luke Woodward Apr 03 '18 at 20:03
  • @LukeWoodward oh excuse me, i was confused. – Barbaros Özhan Apr 03 '18 at 20:05
  • 2
    @LukeWoodward - to be fair the OP contributed to the confusion by tagging the question `[plsqldeveloper]` rather than `[oracle-sqldeveloper]` (although Horseman has since edited the tags). – APC Apr 03 '18 at 20:27

1 Answers1

2

Oracle SQL Developer doesn't work this way. Error messages are written to the Script Output or Query Result panels, depending on if your code was executed via F5 or F9, respectively.

PL/SQL compiler warnings and errors are written to the Log - Compiler panel.

enter image description here

create or replace procedure xyz123 is
begin
 null
end;
/

show errors

Additionally, if you want to see DBMS_OUTPUT included, then SET SERVEROUTPUT ON. It will get written to the Script Output panel.

enter image description here

Now, about raising an exception, this still happens in a PL/SQL block, and we'd still execute that via F5 (Script Output.)

(Code borrowed from SO answer)

DECLARE
    ex_custom EXCEPTION;
    PRAGMA exception_init ( ex_custom,-20001 );
BEGIN
    raise_application_error(
        -20001,
        'This is a custom error'
    );
EXCEPTION
    WHEN ex_custom THEN
        dbms_output.put_line(sqlerrm);
END;

Execute with F5, and...

enter image description here

thatjeffsmith
  • 20,522
  • 6
  • 37
  • 120
  • In my job I'm using SQL Developer Version 1.5.5 and the error pop up is visible. – Derk Apr 04 '18 at 07:15
  • 1.5.5 is about 12 years old... Time to upgrade – thatjeffsmith Apr 04 '18 at 09:17
  • Do I understand properly that this features is impossible to achive in new version of SQL Developer? A liitle odd, because it is difficult to differ this message from dbms_output, especially when the error causes some trigger.. – Derk Apr 04 '18 at 09:38
  • @Derk I just tried version 2.1 as well, from 2010. It operates the same as today. As for catching exceptions, it's a common best practice to log those to a table as explained here http://www.oracle.com/technetwork/issue-archive/2012/12-mar/o22plsql-1518275.html. If you're running this code in a script via SQL*Plus, SQLcl, SQL Developer, then writing to DBMS_OUTPUT is probably OK – thatjeffsmith Apr 04 '18 at 12:27
  • thatjeffsmith It is going rather about situation, when I do same syntax mistake. Then I don't want to ask me whether it is some trigger or my mistake.. "It operates the same as today." Could you tell me then what should i change in the settings to see the pop up after click on execute a script? Best regards – Derk Apr 04 '18 at 13:17
  • if you have an error in your code or script, it will display in the panels as i've shown in the screenshots. – thatjeffsmith Apr 04 '18 at 13:18
  • But it works in this way in Version 17.2.0.188. In 1.5.5 i see the pop up after click on the button. Look here: zapodaj.net/940fb94cc928c.png.html – Derk Apr 04 '18 at 13:22
  • @Derk yes, it worked that way in 1.5.5, but no more, and not for a long time -- see my note about logging your exceptions in TABLES. if you don't do this, you're going to miss problems whether you have popups or not – thatjeffsmith Apr 04 '18 at 13:40
  • This method is familiar to me. I'm using Toad too and the pop up is genereted. Thank you for your help. – Derk Apr 04 '18 at 13:55
  • @Derk sorry, but at least you have your answer. – thatjeffsmith Apr 04 '18 at 14:52