Friday, January 11, 2008

How to execute a PL-SQL procedure via URL?

Step 1: Create the procedure under your
Step 2: Grant execute on to anonymous;
Step 3: Edit $ORACLE_HOME/apex/core/wwv_flow_epg_include_local.sql


Add your in list. The sql has comments which are self explanatory. Please read them before modifying.

Step 4: Invoke the procedure with url with following convention

http://:/apex/.?p=

I have tested the working (without any parametes) and it works fine for me.

Tip: To see text returned on procedure execution use "htp.p" package htp.p('your message');

A sample procedure which prints back on html page:

create or replace procedure test_p
as
begin
htp.p('Welcome!');
-- your code
-- htp.p('End program')
end;

/

No comments: