PL SQL My query says Compiled Successfully, but cannot find the result

Viewed 323

My query says Compiled Successfully, but cannot find the result. Can anyone advise? New to PLSQL. Thanks

2 Answers

This is how I understood the problem.

You didn't specify what you exactly did (what kind of a PL/SQL code is it?), but - it could be a stored procedure:

SQL> create or replace procedure p_test as
  2  begin
  3    dbms_output.put_line('Hello');
  4  end;
  5  /

Procedure created.

or perhaps an anonymous PL/SQL block:

SQL> begin
  2    dbms_output.put_line('Hello');
  3  end;
  4  /

PL/SQL procedure successfully completed.

SQL>

Both of these are supposed to display the "Hello" message. Obviously, neither of them did. I don't know what your PL/SQL code does, but - if it also displays something, enable the output. In SQL*Plus, SQL Developer and some other tools that support it, you'd run

SQL> set serveroutput on

If it is a stored procedure you created, you have to execute it to see the result:

SQL> exec p_test
Hello                                     --> "Hello" is here!

PL/SQL procedure successfully completed.

SQL>

Or, if it is an anonymous PL/SQL block, you don't have to do anything special:

SQL> begin
  2    dbms_output.put_line('Hello');
  3  end;
  4  /
Hello                                     --> "Hello" is here!

PL/SQL procedure successfully completed.

SQL>

See if this helps. If not, explain the problem a little bit better and we'll try to assist.

I assume you are trying to create a function/procedure/package although you haven't shown us your code.

Try this:

   SELECT *
   FROM all_objects
   WHERE owner = (SELECT user FROM dual) 
     AND object_name = '[Your Object Name]'
    ;

It should show you the schema under which your object was created.

Related