0

I am new in PL/SQL, and I tried to define and use procedure like this:

create or replace procedure f()
is
BEGIN
   DBMS_OUTPUT.put_line('Hello world!');
END;
/ 

BEGIN
     f();
END;
/

However, in the call f() an error messege appears, and says "object [user name].f is invalid"

What am I doing wrong?

1 Answer 1

2

When you create your procedure, you should see something like

Warning: Procedure created with compilation errors.

If you type "show errors" or open the procedure in SQL Developer and compile the procedure, you'll get a list of errors. If you do that, you'll see something like

SQL> sho err
Errors for PROCEDURE MY_PROC:

LINE/COL ERROR
-------- -----------------------------------------------------------------
1/19     PLS-00103: Encountered the symbol ")" when expecting one of the
         following:
         <an identifier> <a double-quoted delimited-identifier>
         current delete exists prior

This is telling you that the open and close parent that are part of your create or replace procedure statement are invalid. If a procedure takes no arguments, you would omit the parenthesis in your definition

create or replace procedure f
is
BEGIN
   DBMS_OUTPUT.put_line('Hello world!');
END;

That should compile and should be callable from your anonymous PL/SQL block.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.