How to poll a PL/SQL procedure in BPEL?

Hi,
Normally in BPEL your start your process flows by receiving an event. You can only create a BPEL instance via a Receive or Pick activity. I have a couple of integrations where I have to continually call a PL/SQL procedure and then call another PL/SQL procedure with the output from the first procedure. This is done by invoking 2 partner links and a While activity. I got this working fine. The problem is how to create the instance. At the moment I start the flow by reading in a dummy file with a Receive event. This works for now but if the process has to be restarted it will not work since BPEL know that it has already read the file.
I have tried to start the flow with a receive activity that calls a PL/SQL procedure but I get the error “Operation is not specified” (http://theheat.dk/bpelDb1.jpg). Normally you would use a Invoke activity when calling a PL/SQL procedure, but when I try that I get an error because I don’t have a receive activity first (http://theheat.dk/bpelDb2.jpg)
So basically I need a way to have a receive activity call a PL/SQL procedure.
I have the exact same problem when I need to continually call a Web Service and send the output to a PL/SQL procedure. Here I need an Invoke activity that calls the Web Service and an Invoke that calls the PL/SQL procedure but to get the flow initiated BPEL wants a receive activity.
Regards Pete

I found a simple solution that works but I would like to hear if anybody can see any problems with this approach:
I create a dummy table with one row. I create a partner link that polls the dummy table every 5 minutes. The operation on the table is an update, but the Read value and Unread value are the same!
Every 5 minutes BPEL kicks of a process that calls a PL/SQL procedure etc. There will always be a row in the dummy table and as long as my polling interval is longer than the processing time of the flow I will never have more than one process in-flight at a time. This should ensure that the solution is robust.
Regards Pete
Message was edited by:
Peter Lorenzen
Message was edited by:
Peter Lorenzen

Similar Messages

  • How to call a PL/SQL procedure from a Java class?

    Hi,
    I am new to the E-BusinessSuite and I want to develop a Portal with Java Portlets which display and write data from some E-Business databases (e.g. Customer Relationship Management or Human Resource). These data have been defined in the TCA (Trading Community Architecture) data model. I can access this data with PL/SQL API's. The next problem is how to get the data in the Java class. So, how do you call a PL/SQL procedure from a Java program?
    Can anyone let me know how to solve that problem?
    Thanks in advance,
    Chang Si Chou

    Have a look at this example:
    final ApplicationModule am = panelBinding.getApplicationModule();
    try
         final CallableStatement stmt = ((DBTransaction)am.getTransaction()).
                                                                                         createCallableStatement("{? = call some_pck.some_function(?, ?)}", 10);
         stmt.registerOutParameter(1, OracleTypes.VARCHAR);
         stmt.setInt(2, ((oracle.jbo.domain.Number)key.getAttribute(0)).intValue());
         stmt.setString(3, "Test");
         stmt.execute();
         stmt.close();
         return stmt.getString(1);
    catch (Exception ex)
         panelBinding.reportException(ex);
         return null;
    }Hope This Helps

  • How to call a PL/SQL procedure from Portal

    Env.Info: Windows NT Server 4 (Service Pack 3) / Oracle 8i R3 EE / Oracle Portal 3.0 Production.
    I created a new schema "BISAPPS" and created a user with the same name. Ran provsyns.sql script to grant Portal API access. Created a new package under this new schema and compiled it against the database. After that I registered the schema as a portal provider. There were no errors.
    Now I logged into Portal using the account PORTAL30. Refreshed the portlet repository and the new portlets appeared. I added the new portlet to the page. It is displayed successfully.
    New portlet allows the user to enter a bug-number and lets the user to either view or edit. If the user clicks on the button "Edit", it opens a new window and displays the contents from BugDB application. But if the user clicks on "Show", it should display the output generated by a PL/SQL procedure (Owned by the above New Schema - BISAPPS) in a separate window. But instead it is displaying the following error in the separate window:
    bisapps_pkg.buginfo: PROCEDURE DOESN'T EXIST.
    DAD name: PORTAL30
    PROCEDURE : bisapps_pkg.buginfo
    URL : http://host_name:80/pls/portal30/bisapps_pkg.buginfo
    And list of environment variables ....
    Can anyone help me? How can I call a PL/SQL procedure when the button is clicked? Thanks in advance.

    You must grant EXECUTE privilege on your procedure to the PORTAL30_PUBLIC user. If the error still persists, create a PUBLIC synonym for your procedure.

  • How to secure a PL/SQL procedure that is called from the web browser

    If you have ever seen the sample document management application, and tried to download a file that was stored in the system, you are probably familiar with the apex_util.count_click URL that is used to download the file. If you copy that URL and paste it into a new browser, you will not be prompted to login to download the requested file. I'm using SSO with Apex as a partner application. How can I secure a pl/sql procedure like this to redirect to the login page before beginning the download?
    Thanks,
    Kris

    You can use the second method described here:
    http://apex.oracle.com/pls/otn/f?p=31517:15
    You would use an application process instead of pasting the procedure call in the browser. In the case I describe, you don't need to grant execute to public on the download procedure.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to call a PL/SQL procedure from a xml Data Template

    We have a requirement in which we need to call a pl/sql package.(dot)procedure from a Data Template of XML Publisher.
    we have registered a Data Template & a RTF Template in the XML Publisher Responsibility in the Oracle 11.5.10 instance(Front End).
    In the Data Query part of the Data Template , we have to get the data from a Custom View.
    This view needs to be populated by a PL/SQL procedure.And this procedure needs to be called from this Data Template only.
    Can anybody suggest the solution.
    Thanks,
    Sachin

    Call the procecure in the After Parameter Form trigger, which can be scripted in the Data Template.
    BTW, there is a specialized XML Publisher forum:
    BI Publisher

  • How do I debug pl/sql procedures from a bc4j application

    Hi,
    I would like to use jdevelopers pl/sql debugging capabilities to debug some code that is executed by triggers in the database, when inserting records through my bc4j client application.
    I already found the remote debugging feature of jdeveloper, but that requires setting up a separate debugger listener, and it also requires me to put the following statement in the session:
    DBMS_DEBUG_JDWP.CONNECT_TCP ('hostname_or_ip', port_number)
    Where and how can I put this line of pl/sql code to make it execute each time I launch the bc4j application?
    Or is it possible to use one debugger process (the one that's also using the java breakpoints) to debug both pl/sql and java code?
    Greetings,
    Ivo

    I have the same problem.
    I have a PL/SQL function that returns a number. This function receives 2 parameters. I use StoredProcedureCall plus ValueReadQuery.
    Session aSession = SessionManager.getManager().getDefaultSession();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("CIO_UTILS.COUNT_USER_ROLES_IN_MODULE");
    call.addNamedArgument("p_persid");
    call.addNamedArgument("p_module");
    call.addUnamedOutputArgument("rolesnum", Integer.class);
    ValueReadQuery query = new ValueReadQuery();
    //query.bindAllParameters();
    query.setCall(call);
    query.addArgument("p_persid");
    query.addArgument("p_module");
    Vector parameters = new Vector();
    parameters.addElement(persid);
    parameters.addElement(theModule);
    Integer rolesnum = (Integer) aSession.executeQuery(query,parameters);
    aSession.release();
    if(rolesnum.intValue()<=0)return false; else return true;
    However, I receive the following error:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 96:
    PLS-00312: a positional parameter association may not follow a named association
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call:BEGIN CIO_UTILS.COUNT_USER_ROLES_IN_MODULE(p_persid=>'SANCRA2791', p_module=>'PSL_MONITORING', ?); END;
         bind => [=> rolesnum]
    If comment the line
    "call.addUnamedOutputArgument("rolesnum", Integer.class);"
    Toplink is trating it as a procedure, and I also receive an error from PL/SQL.
    There should have to be a way of make it to receive the resoult somehow, but I do not know what.
    Thanks in advance.

  • Creating a package. How to include standatd PL/SQL procedure?

    Dear All,
    I need to create a job in oracle schema where in it should to do the following actions.
    1. Refresh the Mat View Refresh group.
    2. Execute a procedure immediately after the above refresh happens.
    Hence I tried to create a package to include both the actions. But unable to create.
    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
    Connected as GDB_DEEP
    SQL>
    SQL> CREATE OR REPLACE PACKAGE GDB_GHD_REP AS
      2    PROCEDURE DBMS_Refresh.refresh(refgrp);
      3    PROCEDURE Update_user_details_test();
      4  END;
      5  /
    Warning: Package created with compilation errors
    SQL>
    SQL> CREATE OR REPLACE PACKAGE BODY GLOBALDB_GHD_REP AS
      2    PROCEDURE DBMS_Refresh.refresh('MVRFRSHGRP_GDBGHD');
      3    PROCEDURE Update_user_details_test();
      4  END;
      5  /
    Warning: Package body created with compilation errors
    SQL> I understand that predefined oracle procedures should not be used like this, but Im trying to get a solution.
    Please help me in finding a solution.
    Is it possible to run two procedures one after the other with a single job?
    Regards
    Deep

    Hi, Deep,
    Deep. wrote:
    Dear All,
    I need to create a job in oracle schema where in it should to do the following actions.
    1. Refresh the Mat View Refresh group.
    2. Execute a procedure immediately after the above refresh happens.
    Hence I tried to create a package to include both the actions. But unable to create.
    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
    Connected as GDB_DEEP
    SQL>
    SQL> CREATE OR REPLACE PACKAGE GDB_GHD_REP AS
    2    PROCEDURE DBMS_Refresh.refresh(refgrp);
    3    PROCEDURE Update_user_details_test();
    4  END;
    5  /
    Warning: Package created with compilation errors
    SQL>
    SQL> CREATE OR REPLACE PACKAGE BODY GLOBALDB_GHD_REP AS
    2    PROCEDURE DBMS_Refresh.refresh('MVRFRSHGRP_GDBGHD');
    3    PROCEDURE Update_user_details_test();
    4  END;
    5  /
    Warning: Package body created with compilation errors
    SQL> I understand that predefined oracle procedures should not be used like this, but Im trying to get a solution.
    Please help me in finding a solution.
    Is it possible to run two procedures one after the other with a single job?
    Regards
    DeepSure; call them from your own procedure. For example:
    CREATE OR REPLACE PACKAGE globaldb_ghd_rep AS
          PROCEDURE  refresh_and_test (refgrp  IN  VARCHAR2);
          PROCEDURE  update_user_details_test;
        END;
    SHOW ERRORS
    CREATE OR REPLACE PACKAGE BODY globaldb_ghd_rep AS
          PROCEDURE  refresh_and_test (refgrp  IN  VARCHAR2)
          IS
          BEGIN
              DBMS_Refresh.refresh(refgrp);
                 update_user_details_test;
          END  refresh_and_test;
          PROCEDURE  update_user_details_test
          IS
          END  update_user_details_test;
    END  globaldb_ghd_rep
    SHOW ERRORSWhen used immediately after the CREATE commands, the SQL*Plus command SHOW ERRORS displays more complete error messages.

  • How to call a PL/SQL Procedure from a Report Column Hyperlink

    Hallo!
    Normally a link on a column value in a report leads you to a page in your application or to another URL.
    And you can send the value of this cell to the calling page.
    I want, that oracle executes a procedure with the values as in-Parameters if I click on this hyperlink.
    Must I call a dummy page and define this procedure in the header of this page or exit there other ways?
    Can you give ma an example?
    Thanks a lot!
    Gerhard

    Paul - When a column link is used to invoke a On Demand Process in that way, wouldn't that result in a blank page (unless of course the ODP emits a well-formed HTML document)? You could set the link target to a no-op like *#* and use a onclick handler in the Link Attributes to call a Javascript that uses the htmldb_get object to call the ODP. In fact, I don't think I have ever seen a ODP used in any other context.

  • Need help in writing a tricky sql/PL/Sql Procedure

    Hi,
    I have a Branch table with just two fields in it node1 and Node2, The table looks like this
    node1 | node2
    -------|---------
    1 | 2
    3 | 2
    3 | 4
    4 | 5
    1 | 5
    1 | 6
    5 | 6
    in the above data if you draw lines between node_1 and node_2 you will see that there are 3 different paths to get from 1 to 5, as follows
    /--------6-------\
    1----------------------5
    \2------3-------4/
    Now I need to Find all the nodes between 1 and 5 or all the possible paths from node 1 to node 5 in this case I have 3 possible paths they are as follows
    1-2-3-4-5
    1-3-5
    1-5
    Now I know if this data was stored in a hierarchical manner I can get the results i want by using CONNECT BY and SYS_CONNECT_BY_PATH.
    Is there a way to transform this data into a hierarchcal manner so that I can use the CONNECT BY or can somebody give me an Idea as to how to write a PL/SQL procedure to get the result I want.
    Any help will be greatly appreciated

    Hi!
    1.Create another table Branch1 to hold 'transformed data'.
    2.Use the following procedure to insert data into branch1 table.
    declare
    cursor n is select * from branch;
    begin
    for nrec in n loop
    if nrec.node1 = 5 then
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    elsif nrec.node2= 5 then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    else
    if      nrec.node2> 5      then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    elsif nrec.node1> 5 then
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    elsif (nrec.node1 < nrec.node2 ) then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    else
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    end if;
    end if;
    end loop;
    commit;
    end;
    3.Then execute the following connect by query:
    SQL> select lpad(' ',level*2,' ')||node1 from branch1
    2 start with node1=1
    3 connect by prior node2=node1;
    Hope this is satisfactory.
    Thanks!

  • Custom PL/SQL procedures in Oracle 11.5 10

    Hello,
    How to create Custom PL/SQL procedures in Oracle 11.5 10. I want to create a Stored procedure in oracle 11.5 10 that can be called from any other 3rd party sofware. Please help me out.. if there is any document which will be helpful to me please give me the link.... waiting for responses.....

    Hi,
    Please see these docs.
    Creating a PL/SQL Concurrent Program in Oracle Applications [ID 73492.1]
    Which Application to Specify When Registering a Custom PL/SQL Concurrent Program in Oracle Applications [ID 181004.1]
    Oracle Applications Developer's Guide
    http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115devg.pdf
    Thanks,
    Hussein

  • Pl/sql procedure with shell script

    Hi Guys,
    I will be updating some of the columns in the database thru SQL UPDATE stament. I want to make this process automatic. I.e instead of running manually this uodate process, i want to write a unix script which run on cron job. In the update stament I have to compare date like e_create_date > to_date (........, 'yymmdd') and date should be 2 days previous then to date and I would ike to create the spool file which I would like to send through mail.the script will run automatically.
    I am confused how to write shell script & sql procedure and how to call it inside the shell script. How can this be done.
    Help Appreciated.
    Thanks
    sonu

    save the Store procedure as a create_SP.sql in OS
    save another testrun.sql
    as follows
    begin
    sp_test('&p_test');
    end;
    If you are on a Unix or Solaris OS then
    open a Shell Script as follows :
    and name as test.sh or test.ksh
    var='SYSTEM'
    export var
    sqlplus username/password
    @create_SP.sql
    -- this created a store procedure on the database
    @testrun.sql $var
    This will execute the SP with parameter from OS Variable.

  • TTClasses interface for PL/SQL procedure and fetching its results

    Hi experts,
    I am using TimesTen Release 11.2.1.3.0;
    I created a simple PL/SQL procedure as follows in timesten-
    Command> create or replace procedure employee(eno in emp.empno%type) is
    > e_name emp.ename%type;
    > begin
    > select ename into e_name from emp where emp.empno = eno;
    > dbms_output.put_line(e_name);
    > end;
    > /
    And then I call it through TTClasses as
    TTCmd cmd, compilecmd;
    compilecmd.Prepare(conn,"alter procedure employee compile;",status);
    cmd.Prepare(conn,"begin employee(1020); end;",status);
    cmd.Execute(..);
    cmd.FetchNext(..);
    Here fetchNext is returning an error -
    [TimesTen][TimesTen 11.2.1.3.0 ODBC Driver]Invalid cursor state
    *** ODBC Error/Warning = 24000, TimesTen Error/Warning = 0
    *** Unable to fetch row for statement: <begin employee(1020); end;>.terminate called after throwing an instance of 'TTError'
    Aborted
    How can I run PL/SQL procedures/functions on TimesTen through TTClasses interface?
    Any help or input would be of great value.
    Thanks

    The issue here is nothing to do with TTClasses. Your PL/SQL procedure executes a SELECT statement (that returns just one row) using an implicit cursor within the PL/SQL procedure and retrieves the value of the ename column into the PL/SQL variable. However it does not them do anything with that value such as pass it back to the caller...
    Similarly, the TTClasses code executes a statement that it is expecting to create an ODBC level cursor 9which thsi PL/SQL invocation will not of course) and it is then trying to fetch from a cursor that does not exist.
    I would recommend that you take a look at the TimesTen PL/SQL documentation (Oracle® TimesTen In-Memory Database PL/SQL Developer's Guide Release 11.2.1) and refer to the section on IN, OUT and IN/OUT parameters. This will show you how you can use OUT parameters to return values to the caller. This technique works fine for ODBC, JDBC and OCi programs but does not sadly currently work with TTClasses. TTClasses has not yet been enhanced to support OUT and INOUT parameters. Of course as you have the source code for TTClasses you could make the necessary modifications yourself.
    I will open a bug requesting that TTClasses support OUT and INOUT parameters but in the meantime if you need this kind of capability you will need to either modify TTClasses yourself or switch to using a different API.
    Chris

  • Calling pl/sql procedure from jsp

    Hi:
    Could anyone tell me how to call a pl/sql procedure from a jsp page by passing args or without . Is there any specific method to use.
    Thanks.

    Like from any other java code
    <%
    Connection conn = DriverManager.getConnection(...);
    CallableStatement cs = conn.prepareCall("BEGIN myprocedure(); END;");
    cs.execute();
    %>
    With params:
    <%
    Connection conn = DriverManager.getConnection(...);
    CallableStatement cs = conn.prepareCall("BEGIN myprocedure(?, ?); END;");
    cs.setInt(1, 10);
    cs.setString(2,"aaaa");
    cs.execute();
    %>
    to return some value as out param
    Connection conn = DriverManager.getConnection(...);
    CallableStatement cs = conn.prepareCall("BEGIN myprocedure(?, ?, 3); END;");
    cs.setInt(1, 10);
    cs.setString(2,"aaaa");
    cs.registerOutParameter(3, Types.VARCHAR);
    cs.execute();
    out.println("Returned value: " + cs.getString(3));
    %>
    Of course after all close statement and connection to free resources.

  • How to send a java array to a pl/sql procedure

    Hi,
    This is similar to a post about 6 months ago on retrieving pl/sql tables from a java application but I can't seem to figure out how to use what I learned there to solve this.
    In a java application I have a Long[] array, and in the database I have a pl/sql procedure which takes a numeric in parameter. I currently loop through the array in my java application and call the procedure multiple times. What I'd prefer to do is to be able to pass the entire array to a new procedure which performs the looping internally.
    John
    null

    Kathy,
    Search the archives of this forum and the JDBC forum for the terms STRUCT and ARRAY and you can find some sample code on the JDBC How-To Documents page and the JDBC Samples which can both be accessed from this page:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • How to get data from URL in a PL/SQL procedure

    Hi!<br>
    <br>
    I want to pass values in APEX from a report with a link to a PL/SQL procedure through URL.
    How can I make this?<br>
    <br>
    For example:<br>
    <br>
    I have a report:<br>
    <br>
    select<br>
       id,<br>
       name,<br>
       akt,<br>
       case<br>
          when akt is NULL then '< a href="f?p=&APP_ID.:27:&SESSION.:START_PROCESS" name="test_link" >set< /a >'<br>
       end choice<br>
    from<br>
       USERS;<br>
    <br>
    I want to pass the value "id" in the link ( named "test_link" ) . And want to use this value in a process like this:<br>
    <br>
    DECLARE<br>
       v_user_id NUMBER(10);<br>
    BEGIN<br>
       --I want to read this value from the url<br>
       if :REQUEST='START_PROCESS' then<br>
          v_user_id := ????;<br>
          <br>
          ...<br>
       end if;<br>
    END;<br>
    <br>
    <br>
    Thanks!<br>
    Marton

    Hi,
    1- Create a hidden item P27_USER_ID on page 27
    2- Change your code :
    SELECT ID, NAME, akt,
           CASE
              WHEN akt IS NULL
                 THEN    '< a href="f?p=&APP_ID.:27:&SESSION.:START_PROCESS:NO::P27_USER_ID:'
                      || ID
                      || '" name="test_link" >set< /a >'
           -- refer to f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
           END choice
      FROM users;
       And then
    DECLARE
       v_user_id   NUMBER (10);
    BEGIN
       --I want to read this value from the url
       IF :request = 'START_PROCESS'
       THEN
          v_user_id := :p27_user_id;
           --your code
       END IF;
    END;Hope this helps,
    Grégory

Maybe you are looking for