1

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?

3
  • Just to clarify. I mean SQL Scripts in SQL Workshop of APEX. Commented Nov 4, 2014 at 17:46
  • 2
    Why would you want to do this? Sounds like a strange way to go about things, unless I misunderstand the question Commented Nov 5, 2014 at 3:16
  • I updated my answer, hope it will help now. Commented Nov 5, 2014 at 10:03

1 Answer 1

1

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.

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

3 Comments

Yes, but my question is about APEX SQL script particularly, not pages. I want to use procedures in APEX SQL script. Writing anonymous block in APEX SQL script will run it, but then adding procedure leads to errors and I don't know how to call them.
Ohhh... I had made a little mistake ;) You mean SQL Scripts in SQL Workshop? As I understood, that scripts has to be like scripts for sqlplus.
No worries :) Exactly, I mean SQL Scripts in SQL workshop. So there is any entry point for that sqlplus scripts and ability to define/call procedures?

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.