Executing a stored procedure using a button within a region

Hello APEX Users:
I have the task of creating a link within an apex region to execute a stored procedure from another schema using two arguments. What is the best method of executing a procedure in apex using a link or button? Thanks.
Ben

Stop posting follow-ups to closed/old threads.
<li>Other users may ignore the thread as it appears to be closed
<li>Your assumption that the questions are related may be incorrect, leading to confusion about the nature of the problem and potential solutions.
<li>Watches on the thread may have expired, so the original participants may be unaware of the new post, or they may no longer be active on the forum
<li>APEX Phone Test
<li>You have no ability to mark posts as helpful or correct
Post your question as a new thread, including the following information:
<li>APEX version
<li>DB version and edition
<li>Web server architecture (EPG, OHS or APEX listener)
<li>Browser(s) used
<li>Theme
<li>Templates
<li>Region type
<li>Links to related posts and threads using the methods in the FAQ.
Your question has NOTHING to do with this thread.
And update your forum profile with a better handle than "862509".

Similar Messages

  • Is it possible to execute a stored procedure using the JDBC adapter?

    Hi all,
    Can anybody confirm whether we can execute a stored procedure created in a database using the processing parameters of a JDBC adapter of a communication channel?
    If yes, then please let me know how (may be with an example)
    Thanks.

    Yes, that is possible. You have to chose EXECUTE in the action field to execute the stored procedure. Here's a little piece on the JDBC receiver:
    JDBC Receiver
    For writing data to an SQL database you also need to define a strict data type. The general format is like this:
        <ns:MT_RECORDSET>
              <STATEMENT>
                   <TABLE_NAME ACTION="">
                        <TABLE/>
                        <ACCESS>
                             <FIELD1/>
                             <FIELD2/>
                             <FIELDn/>
                        </ACCESS>
                        <KEY>
                             <ID compareOperation=""/>
                             <FIELDx compareOperation=""/>
                        </KEY>
                   </TABLE_NAME>
              </STATEMENT>
    </ns:MT_RECORDSET>
    This recordset represents an SQL statement like "update TABLE1 set FIELD1=123, FIELD2=456, FIELDn='xyz' where ID=12345 and FIELDx is NULL"
    MT_RECORDSET is the name of the Message Type used.
      For the value of the attribute ACTION you can choose from the following values:
         UPDATE : updates the given fields in the table with their new values
         INSERT : insert the given fields as a new row in the table
         UPDATE_INSERT : insert rows in the table when update is not possible
         DELETE : deletes given fields from the table
         SELECT : selects given fields from the table. Note that this option returns a response in the JDBC Sender form!
         EXECUTE : execution of a stored SQL procedure
         SQL_QUERY | SQL_DML : option to transfer more complex SQL statements to the database
      The attribute compareOperation can have the following values:
         EQ : equal
         NEQ : not equal
         LT : less than
         LTEQ : less than or equal to
         GT : greater than
         GTEQ : greater than or equal to
         LIKE : used to compare strings

  • Can't execute Oracle Stored Procedure using JDBC

    Hi all,
    I'm fairly new to JDBC and Oracle, so pardon my ignorance/lack of knowledge in this subject matter. I am trying to call a stored procedure named get_countries that has no parameters using JDBC. I do this by executing the following lines of code:
    CallableStatement cs = con.prepareCall("{call get_countries}");
    ResultSet rs = cs.executeQuery();But I get the following exception thrown:
    Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GET_COUNTRIES'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.DatabaseError.throwSqlException(_DatabaseError.java:112_)
    at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:331_)
    at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:288_)
    at oracle.jdbc.driver.T4C8Oall.receive(_T4C8Oall.java:745_)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(_T4CCallableStatement.java:218_)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(_T4CCallableStatement.java:969_)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(_OracleStatement.java:1190_)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(_OraclePreparedStatement.java:3370_)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(_OraclePreparedStatement.java:3415_)
    at JDBCTest.main(_JDBCTest.java:44_)
    This makes no sense to me because there are no parameters that I need to pass. So I'm guessing this is something that I don't know about JDBC or about Oracle. I've searched Google for the past hour and a half and still haven't found anything that explains what might be the problem. I've also been following this guide ([http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]) and I'm doing it exactly the same way, but for some reason it works for them.
    Anyone know what I'm doing wrong?
    Thanks for your help in advance. I really appreciate it!

    I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
    THE SOLUTION
    cs = con.prepareCall("{ call get_countries(?) }");
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);

  • How to execute a stored procedure using Nqcmd

    hi everyone,
    I am having a stored procedure in Database which i want to execute it from nqcmd. Could anyone pls let me know how to execute it.
    Regards

    EJB3 JPA does not define stored procedure execution. There is a native query in JPA, but this is mainly for SQL. If you stored procedure has no output parameters you can normally get away with using a native query to execute it (be sure to include BEGIN/END in Oracle).
    <p>
    In TopLink 11g preview there are JPA extensions for defining stored procedures. You can use the @NamedStoredProcedureQuery for this, and then access the named query by name and execute it. You can also create an instance of a TopLink StoredProcedureCall and set it in your JPA Query through the TopLink Query extension setDatabaseQuery(), or define the named stored procedure query using a DescriptorCustomizer.
    <p>
    In TopLink Essentials there is no direct stored procedure support, so you would need to use JDBC directly.
    <p>
    If you are using a DataSource in your application the best way to get a JDBC connection is to use your DataSource directly. If the DataSource is JTA managed this will be the same connection that TopLink writes with.
    <p>
    If you need to get the connection directly from TopLink you can use,
    ((oracle.toplink.<essentials>.ejb.cmp3.EntityManager)entityManager.getDelegate()).getUnitOfWork().getConnection();
    <p>
    You may need to first call, UnitOfWork.beginEarlyTransaction(), (also ensure you release the uow connection).
    <p>
    <p>---
    <p>James Sutherland

  • How to execute MYSQL stored procedure  using java

    Hello friend
    I am very new to MYSQL stored procedure how to call external stored procedure , from where i got good tutorials about MYSQL stored procedure and JAVA

    If you need help with MYSQL or stored procedures this is not the place. If you need help with JDBC:
    http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html

  • Error while Executing stored procedure using ant

    Hi,
    I am trying to execute a stored procedure using ant ..
    My build.xml is like this...
    <project name="myproject" default="db.build">
    <target name="db.build">
    <sql driver="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@idm.orademo.com:1521:orcl"
    userid="test"
    password="oracle11g"
    print="yes"
    classpath="E:\\ojdbc14.jar"
    src="E:\\upg_9102BP07.sql" />
    <!--
    <classpath>
    <pathelement path=""\\>
    <\\classpath> -->
    </target>
    </project>
    I have my stored procedure in upg_9102BP07.sql as shown in above src..
    When im executing ant cmd I got the following exception
    E:\>ant -f test.xml
    Buildfile: test.xml
    db.build:
    *[sql] Executing resource: E:\upg_9102BP07.sql*
    *[sql] Failed to execute: declare cnt int*
    BUILD FAILED
    E:\test.xml:12: java.sql.SQLException: ORA-06550: line 1, column 15:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    *:= . ( @ % ; not null range default character*
    Total time: 44 seconds
    I have no clue.. But this sql ran successfully when did manually..
    Please help me in solving the issue...
    -- Marias

    Here is my script bit lengthy...
    Rem
    Rem $Header: oim/server/Database/Oracle/Upgrade/Release91x/910x/List/9102_ddl_AddcolumnToRCE_Oracle.sql st_oim_devjain_bug-9003841/1 2009/10/09 02:24:19 devjain Exp $
    Rem
    Rem 9102_ddl_AddcolumnToRCE_Oracle.sql
    Rem
    Rem Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    Rem
    Rem NAME
    Rem 9102_ddl_AddcolumnToRCE_Oracle.sql - <one-line expansion of the name>
    Rem
    Rem DESCRIPTION
    Rem Create a new column 'RCE_DELETE' in RCE table
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem blaksham 09/30/09 - Created
    Rem
    declare cnt int;
    Begin
         Select Count(1) into cnt From User_Tab_Columns Where TABLE_NAME='RCM' And COLUMN_NAME='RCM_DELETE';
         IF cnt=0 Then
         Begin
              Execute Immediate 'ALTER TABLE RCM ADD RCM_DELETE VARCHAR2(1)';
         End;
         Else
              DBMS_OUTPUT.PUT_LINE('Column already exists in the DB');
         End IF;
    End;
    Rem
    Rem $Header: oim/server/Database/Oracle/Upgrade/Release91x/910x/List/9102_dml_odf_source_name.sql st_oim_devjain_bug-9003841/1 2009/10/09 02:44:45 devjain Exp $
    Rem
    Rem 9103_dml_odf_source_name.sql
    Rem
    Rem Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    Rem
    Rem NAME
    Rem 9103_dml_odf_source_name.sql - <one-line expansion of the name>
    Rem
    Rem DESCRIPTION
    Rem <short description of component this file declares/defines>
    Rem
    Rem NOTES
    Rem <other useful comments, qualifications, etc.>
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem vpotukuc 09/17/09 - Bug8796435: Increase the size of odf_source-name
    Rem vpotukuc 09/17/09 - Created
    Rem
    SET ECHO ON
    SET FEEDBACK 1
    SET NUMWIDTH 10
    SET LINESIZE 80
    SET TRIMSPOOL ON
    SET TAB OFF
    SET PAGESIZE 100
    declare
    collen NUMBER := 0;
    begin
    select char_length into collen from user_tab_columns where table_name = 'ODF' and column_name = 'ODF_SOURCE_NAME';
    IF (collen < 400) then
    execute immediate 'alter table ODF modify ODF_SOURCE_NAME varchar2(400)';
    END IF;
    END;
    File name: 91_dml_update_reviewers_With_NoEmail_attestation.sql
    Purpose: Modify the email template to replace the 'Delegated By Last Name' with 'Reviewer Last Name' and 'Delegated By User Id' to 'Reviewer User Id'.
    Author: Babu Lakshamanaiah
    Description: Modify the email template 'Attestation Reviewers With No E-mail Addresses Defined'
    declare
    cnt int;
    begin
    Select Count(1) into cnt From emd Where emd_name='Attestation Reviewers With No E-mail Addresses Defined' and emd_language='en' and emd_country='US';
    IF cnt=0 Then
    Begin
    DBMS_OUTPUT.PUT_LINE('There is no record with emd_name Attestation Reviewers With No E-mail Addresses Defined ');
    End;
    Else
    update emd set emd_body='The following attestation reviewers do not have email addresses defined. Attestation requests have been generated for these reviewers and can be accessed by loging in to Oracle Identity Manager. However, notification emails were not sent.' ||chr(10) || chr(10) ||
    'Attestation process: <Attestation Definition.Process Name>' || chr(10) ||
    'Attestation Request ID: request <Attestation Request.Request Id>' || chr(10) ||
    'Request date: <Attestation Request.Request Creation Date>' || chr(10) || chr(10) ||
    'Reviewers Without E-mail Address: <reviewers> ' || chr(10) ||
    '<Attestation Task.Reviewer First Name> <Attestation Task.Reviewer Last Name> [<Attestation Task.Reviewer User Id>]' Where emd_name='Attestation Reviewers With No E-mail Addresses Defined' and emd_language='en' and emd_country='US';
    End IF;
    commit;
    end;
    Please help me out.....
    --Marias                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Executing a stored procedure from an Ifs Program

    I have a need to execute a stored procedure in another schema
    within the same database, and I need to receive an OUT parameter
    to continue processing. The oracle.ifs.server.sql.IfsConnection
    is not in my class path. Can someone tell me which jar file to
    adde to my classpath to have this funcitonality that IFS claim.
    Regards,
    Jeff

    Guys I need help with this one as soon as possible.

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • Error while executing a stored procedure from forms6i

    When I execute a STORED PROCEDURE from ORACLE DB 10g this procedure works perfectly fine.
    But when I execute the same from the FORMs 6i I get the following error:
    PDE-PLU022 Don't have access to the stored program unit
    XMLPARSERCOVER in schema CARE.
    where XMLPARSERCOVER is the class and
    CARE is the schema.
    Regards,
    Jignesh S

    I have tried this with both the owner of the schema and the intended user, -from both forms and directly.
    All rights was granted on the stored procedure. Since posting I have found that one of the tables that the procedure might insert into, was not explicitly granted to the intended user, and after rectifying that the error message went away.
    -however, the procedure now silently "finishes" without any evidence that it ever ran, if invoked from the forms application. When invoked from SQL Plus (or JDev, or Toad) it runs as expected.
    I have no public synonym for the procedure, -is that necessary?
    The stored procedure in question is implemented in java, and published as a stored procedure. It does rather heavy lifting, when running, using a view against another server , updating local tables and quite a lot of data validation/cleansing, and logging. All recourses are within the same schema.
    Any ideas?

  • Calling an Oracle stored procedure using Toplink API - Please help

    Hi,
    We are evaluating Toplink as a possible data access layer in large service-oriented application. The ability to call db stored procedures from within business object layer is crucial for our architechture.
    I am trying to follow toplink application developer's guide examples on how to call stored procedures using toplink.
    I have the folling java code:
    call.setProcedureName("PR_ROMAN_TEST");
    call.addNamedArgument("IN_PARAM");
    call.addNamedOutputArgument("OUT_PARAM");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("IN_PARAM");
    Vector params = new Vector();
    params.addElement(new Integer(5));
    Number result = (Number) session.executeQuery(query, params);
    This generates the following SQL statement:
    BEGIN PR_ROMAN_TEST(IN_PARAM=>5, OUT_PARAM=>?); END;
    An attempt to execute it causes a
    java.sql.SQLException: Invalid column index.
    As I understand it, this exception is thrown because of the "?" in place of the out-parameter value holder.
    The SQL statement that I would want toplink to generate and execute should look like:
    DECLARE result number; BEGIN PR_ROMAN_TEST(IN_PARAM=>5, OUT_PARAM=>result); END;
    , but how do I achieve it and how do I capture the return value, all using toplink api?
    Please help
    Thank you in advance,
    Roman

    I read the conversation above. I am running into a similar kind of problem. I get the following error.
    <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Error Code: 6550Local Exception Stack: Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException Exception Description: java.sql.SQLException: ORA-06550: line 1, column 38: PLS-00103: Encountered the symbol "NAME" when expecting one of the following:. ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like as between from using || The symbol "." was substituted for "NAME" to continue.ORA-06550: line 1, column 55: PLS-00103: Encountered the symbol "ID" when expecting one of the following:. ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 38:PLS-00103: Encountered the symbol "NAME" when expecting one of the following . ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like as between from using || The symbol "." was substituted for "NAME" to continue.ORA-06550: line 1, column 55:PLS-00103: Encountered the symbol "ID" when expecting one of the following: . ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Error Code: 6550 at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:227)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:733)
    at oracle.toplink.internal.databaseaccess.DatabasePlatform.executeStoredProcedureCall(DatabasePlatform.java:1605)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:649)
    at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:506)at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:131)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:115)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(CallQueryMechanism.java:194)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(CallQueryMechanism.java:175)
    at oracle.toplink.queryframework.DirectReadQuery.executeNonCursor(DirectReadQuery.java:65)
    at oracle.toplink.queryframework.DataReadQuery.execute(DataReadQuery.java:73)
    at oracle.toplink.queryframework.ValueReadQuery.execute(ValueReadQuery.java:59)
    at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:493)
    at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:125)
    at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1958)
    at oracle.toplink.threetier.ServerSession.internalExecuteQuery(ServerSession.java:629)
    at oracle.toplink.threetier.ClientSession.internalExecuteQuery(ClientSession.java:392)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2246)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1055)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate$2.readFromSession(TopLinkTemplate.java:181)
    at com.eplinc.common.persistence.toplink.SessionReadCallback.doInTopLink(SessionReadCallback.java:59)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.execute(TopLinkTemplate.java:110)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.executeQuery(TopLinkTemplate.java:178)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.executeQuery(TopLinkTemplate.java:172)
    at com.epl.outletteller.dao.toplink.TopLinkOIDGeneratorDAO.generateId(TopLinkOIDGeneratorDAO.java:45)
    The call I am making is as follows :
    public long generateId(String name, long outletId) throws DataAccessException {
    TopLinkTemplate tlTemplate = new TopLinkTemplate();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("AUTONUM.GET_NEXT_VALUE");
    call.addNamedArgument("autonum name");
    call.addNamedArgument("outlet id");
    call.addNamedOutputArgument("OUTPUT_1");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("autonum name");
    query.addArgument("outlet id");
    Object[] parameters = new Object[2];
    parameters[0] = name;
    parameters[1] = Long.toString(outletId);
    Number uniqueNumber = (Number)tlTemplate.executeQuery(query,parameters);
    return uniqueNumber.longValue();
    This is my Table AUTONUM_SETTING
    AUTONUM_NAME AUTONUM_TYPE START_VAL END_VAL INCREMENT_VALUE
    TRAN_NUM GLOBAL 1 999999 1
    TRACE_NUM OUTLET 1 999999 1
    Any help would be appreciated. Thanks

  • Need an Example for How to call a Stored Procedure using DBAdapter

    Hi
    I am trying to invoke a stored procedure in Oracle Database using DB Adapter. I have successfully invoked and when i try to run it i got the following error.
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'ExecuteScript' failed due to:
    Stored procedure invocation error.
    Error while trying to prepare and execute the RESONANCEDEMO.SP_QUERY API.
    An error occurred while preparing and executing the RESONANCEDEMO.SP_QUERY API. Cause: java.sql.SQLSyntaxErrorException: ORA-00917: missing comma
    ORA-06512: at "RESONANCEDEMO.SP_QUERY", line 7
    ORA-06512: at line 1
    Check to ensure that the API is defined in the database and that the parameters match the signature of the API.
    This exception is considered not retriable, likely due to a modelling mistake.
    To classify it as retriable instead add property nonRetriableErrorCodes with value "-917" to your deployment descriptor (i.e. weblogic-ra.xml).
    To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff.
    All properties are integers.
    I am trying to have a Out Parameter in my Procedure. Please provide me an example on how to invoke a Stored Procedure using Out Paramter using DB Adapter.

    Hi,
    It looks more like an Oracle error and not within the DbAdapter.
    Try to test first your procedure from PL/SQL or other developer you are using.
    Arik

  • How to obtain username and date of users who executed a stored procedure

    Hi,
    I am modifying a stored procedure called storedprocedure_A. Within the storedprocedure_A, I want to obtain the date and username that is executing the storedprocedure_A. The date, I can obtain from sysdate. But I do not know which data dictionary to obtain the particular username that is currently executing the procedure. Thank you.

    It also depends on whether it is a two-tier or three-tier application that connects to your database.
    Most three-tier applications use a connection pool, or a schema user for the purpose of connecting to the database that they can control and grant roles or privileges from within the application.
    Most two-tier applications, however, connect directly as the user and then you could capture the user from dual the way it was recommended above. Either that, or you can capture the USERNAME, or OSUSER from v$session.
    If the application uses connection pools, or a single user, there is usually a table (or tables) that have the connecting username that logs into the application so they can control appropriate privileges. You would have to investigate to find the table for this purpose and then you could query that table to capture the username information.
    You may also consider using aud$ (turning on audit session). I've done this quite a bit and it worked fine.

  • Error while calling a stored procedure using SQLJ

    I am calling a stored procedure defined inside a package through a SQLJ script. The first parameter of that procedure is a IN OUT parameter which is used as a ROWID for creating a cursor. That ROWID value is the same for every record in the table, thereby enabling us to create a cursor.
    When I give a hard-coded value as a parameter, I get an error stating that the assignment is not correct as the query is expecting a variable and not a literal. Hence I removed the hard-coded value and included a dymanic value in the SQLJ call.
    String strVal = "A";
    #sql{CALL ASSIGNMENTS_PKG.INSERT_ROW :{strVal},'SALARY_CODE_GROUP','BU',3,105,sysdate,1,sysdate,1,1)};
    Here "ASSIGNMENTS_PKG" is a package name and INSERT_ROW is the procedure.
    When the SQLJ program is run, I get an error stating:
    "PLS-00201: identifier 'A' must be declared"
    I read the error message, but I am not able to understand where I need to give the GRANT permission to.

    If you're using Oracle Provider for OLE DB (OraOLEDB) to execute this stored procedure, you need to set PLSQLRSet attribute. This attribute can be set in registry, connection string, or command object. Please refer to User Documentation for more information.

  • How to bind arrays to PL/SQL stored procedure using OCI?

    Hi,
    We are having problems trying to bind arrays to PL/SQL stored procedure using OCI. Here is the situation:
    - We have a stored procedure called "GetVEPFindTasks" with the following interface:
    PROCEDURE GetVEPFindTasks (
    p_ErrorCode OUT NUMBER,
    p_ErrorMsg OUT VARCHAR2,
    p_RowCount OUT NUMBER,
    p_VEPFindTasks OUT t_VEPFindTaskRecordTable,
    p_MaxTask IN NUMBER);
    t_VEPFindTaskRecordTable is a record with the following entries:
    TYPE t_VEPFindTaskRecord IS RECORD (
    RTCID NUMBER,
    TransNum NUMBER,
    TransTimestamp VARCHAR2(20),
    Pathname1 image_data.pathname%TYPE,
    Pathname2 image_data.pathname%TYPE,
    Pathname3 image_data.pathname%TYPE,
    OperatorID operator.id%TYPE);
    - Now, we are trying to call the stored procedure from C++ using OCI (in UNIX). The call that we use are: OCIBindByName and OCIBindArrayOfStruct to bind the parameters to the corresponding buffers. We bind all parameters in the interface by name. Now, we do bind the record's individual item by name (RTCID, TransNum, etc.), and not as a record. I don't know if this is going to work. Then, we use the bind handles of the binded record items (only record items such as RTCID, TransNum, and NOT error_code which is not part of the record) to bind the arrays (using OCIBindArrayOfStruct).
    All of the parameters that are binded as arrays are OUTPUT parameters. The rest are either INPUT or INPUT/OUTPUT parameters. Now, when we try to execute, OCI returns with an error "Invalid number or types of arguments" (or something to that sort... the number was something like ORA-06550). Please help...
    Is there any sample on how to use the OCIBindArrayOfStruct with PL/SQL stored procedures? The sample provided from Oracle is only for a straight SQL statement.
    Thank's for all your help.
    ** Dannil Chan **

    As you said:
    You have to pass in an array for every field and deconstruct/construct the record in the procedure. There is no support for record type or an array of records. Can you give me a example? I'am very urgently need it.
    thanks
    email: [email protected]

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

Maybe you are looking for