Question

How can I execute an oracle stored procedure ?

  • 3 February 2022
  • 2 replies
  • 17 views

I have created a stored procedure in oracle to refresh oracle materialized views, I turned to stored procedure because I was originally trying to do it in run sql after execution but it kept failing with invalid sql . No I have teh sored procedure and I have placed it in sqlExecutor to test and its still returning errors..

 

this is the oracle create procedure statement (names changed )

 

create or replace PROCEDURE "MYProcedure" AS 

BEGIN

 DBMS_MVIEW.REFRESH('A,B,C,D', method => 'F', atomic_refresh => FALSE );

END;

 

and this is how I try to execute it in sqlCreator

 

FME_SQL_DELIMITER /

begin

exec NBPNBICASPER_VIEW 

end ;

/

 

This fails and the only way I get no error (but nothing runs ) is put : in front of the procedure name )

 

FME_SQL_DELIMITER /

begin

exec :NBPNBICASPER_VIEW 

end ;

/

 

 

What am I doing wrong .. Have I gone about this incorrectly? any help direction etc. is hugely appreciated.

 

Paul


2 replies

Userlevel 4

Try using this syntax:

begin
    NBPNBICASPER_VIEW();
end;

See also https://community.safe.com/s/article/running-a-oracle-stored-procedure

If that still doesn't work, please post the error messages.

​thanks David_r , perfect answer …..    and I had tried this earlier and it was throwing errors so I decided it didn't work - but your answer made me persist - and it turns out that the issue was actually with the stored procedure in Oracle ..    fixed the procedure now and appears to work (on a test) FME SqlCreator is not throwing errors.

 

Thanks a mil for taking the time out to respond 👍

Reply