1
votes

I am trying to understand how to use multiple procedures in APEX SQL script. First I don't really need stored procedure, but not sure how to declare simple procedure in APEX SQL script. So this is my attempt:

create or replace procedure test1 as
begin
    DBMS_OUTPUT.ENABLE;
    dbms_output.put_line('test1');
end;

execute test1;

This gives me an error:

Error at line 7: PLS-00103: Encountered the symbol "EXECUTE"    

So questions - how to create regular/not stored/ procedures in one SQL script and then call them. What is the entry point of execution in APEX SQL script?

1
Just to clarify. I mean SQL Scripts in SQL Workshop of APEX.Pablo
Why would you want to do this? Sounds like a strange way to go about things, unless I misunderstand the questionScott
I updated my answer, hope it will help now.Dmitriy

1 Answers

1
votes

UPD (At the first time I understood question totally wrong)

Correct version of a script:

create or replace procedure test1 as
begin
    DBMS_OUTPUT.ENABLE;
    dbms_output.put_line('test1');
end;
/
begin
  test1;
end;
/

Documentation says, that script can contain inly SQL and PL/SQL commands. Commands of sqlplus will be ignored.

OLD VERSION (Let stay here)

In APEX pages you can use PL/SQL anonymous blocks. For example, you can create process (APEX has some types of them) or PL/SQL region, and use following:

declare
   ...
begin
   some_proc(:P_MY_ITEM);
end;

Here you can invoke any procedure and do anything else that allowed by PL/SQL. Also you can use parameters like :P_ITEM_NAME to get and set values of page and application items.