Home » RDBMS Server » Server Administration » Call Procedure
Call Procedure [message #370180] Thu, 28 December 2000 13:54 Go to next message
Ralphie
Messages: 14
Registered: October 2000
Junior Member
I have created the Procedure as described to me, but how do I call a procedure from an SQL*Plus prompt?

Here is the procedure:

CREATE OR REPLACE PROCEDURE LOAD_LM_TEST (info char) AS
BEGIN
Insert into LM_TEST
(seq_num.nextval, info)
END LOAD_LM_TEST;
/

I recieve this error upon creation:

Warning: Procedure created with compilation errors.

I call it like this:

Begin
LOAD_LM_TEST('test this');
End;

It is not a recognized command.

Thank you in advance,

Chris
Re: Call Procedure [message #370181 is a reply to message #370180] Thu, 28 December 2000 14:40 Go to previous messageGo to next message
Shanthi Ramayanapu
Messages: 22
Registered: October 2000
Junior Member
To look at the compilation errors command is
show errors at SQL prompt
or
select * from user_errors

To execute the procedure
execute procedure_name at SQL prompt

Shanthi
Re: Call Procedure [message #370182 is a reply to message #370180] Thu, 28 December 2000 14:44 Go to previous messageGo to next message
Tuner
Messages: 2
Registered: December 2000
Junior Member
The way you are calling the procedure is correct..

But Semicolon is missing at the end of insert statement in the procedure.
Create a procedure without error/warning.
Re: Call Procedure [message #370183 is a reply to message #370182] Thu, 28 December 2000 15:38 Go to previous messageGo to next message
Ralphie
Messages: 14
Registered: October 2000
Junior Member
No, the way I was calling it was not correct from an SQL*Plus prompt. The proper way to call from an SQL*Plus prompt is:

execute LOAD_LM_TEST('Yes this works!');

The problem with my procedure was this:

Insert INTO LM_TEST (seq_num_val, info) VALUES (seq_num.nextval, info_val);

Thank you,

Chris
Re: Call Procedure [message #370184 is a reply to message #370181] Thu, 28 December 2000 15:44 Go to previous messageGo to next message
Ralphie
Messages: 14
Registered: October 2000
Junior Member
Thank you. I could see the error when I slected all errors from user_errors. I fixed the Isert statement and executed the Procedure correctly.

How would I invoke the procedure through SQL statements in external programms?

Thank you very much,

Chris
Re: Call Procedure [message #370185 is a reply to message #370181] Thu, 28 December 2000 16:20 Go to previous message
sverch
Messages: 582
Registered: December 2000
Senior Member
Just put its name inside of your code where u need it. u do not need to write "execute", only
procedure_name.
Previous Topic: help with query
Next Topic: Re: Help required
Goto Forum:
  


Current Time: Thu May 16 21:57:22 CDT 2024