Execute ORACLE STORE PROCEDURE from DATABASE

Hi Everyone...
i have a store procedure, it has a 5 params, 3 are IN parameters and 2 left are OUT parameters, I need execute this store procedure using a SQL Intruction like this
DECLARE integracion_sia_kac PROCEDURE FOR KACTUS.SP_SIAKAC_NMDHODO
:ll_horario,
:ll_ide_doc,
:ls_con_kac,
@PINDREGI=:ls_ind_registro output, @PVALERRO=:ls_error_int output
USING gt_kactus;
i think this function is using from MSSQL Server, this has a three IN params but the declaration of the OUT params I don't understand.
HELP ME!!!!!.... I need know way to execute the SP
Thanks

Well it is very simple!
example:
CREATE OR REPLACE PROCEDURE PROC1 (P1 IN NUMBER, P2 IN NUMBER, P3 OUT NUMBER) IS
BEGIN
P3 := P1 + P2;
END;
This is how to use PROC1 from, say, PROC2 :
CREATE OR REPLACE PROCEDURE SomeShema.PROC2 IS
Var1 NUMBER(15,2);
Var2 NUMBER(15,2);
ReturnParamFromPROC1 NUMBER(15,2);
BEGIN
Select SomeField INTO Var1 from Table1 where Table1.ID = 10;
Select SomeField INTO Var2 from Table2 where Table2.ID = 20;
PROC1(Var1, Var2, ReturnParamFromPROC1);
DBMS_OUTPUT.PUT_LINE('Returned value from PROC1 is : '||ReturnParamFromPROC1);
END;

Similar Messages

  • Calling Oracle store procedure from Crystal 11 command

    I need to call Oracle store procedure from Crystal Command. The Store proc has ref cursor. Is it possible. Can you post few examples?
    Also, is it possible to have multiple sql statements in a Crystal Command, when working with Oracle 10g?
    It is working for SQL server.

    Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly.

  • How to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server

    how to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server?
    Does any body can tell me about this?
    thanks
    [email protected]

    Hi 
    Did you succeed to execute the procedure?
    How ?
    Thanks
    Shimon Zerbib

  • Execute Oracle Stored Procedure from Excel

    Is it possible to execute an Oracle Stored Procedure from Microsoft Excel and return the result of the Oracle Store Procedure into the excel spreadsheet.

    Yes. You can use Oracle Objects for OLE to accomplish this. It comes with Excel examples and an online help file with many more examples.

  • 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();
    }

  • Executing Oracle DB Procedure from JACL Script

    May I know if JACL DBAdmin class has method to call stored procedures? I am able to call prepareCall() method from my jacl, however when I call preparecall() method by passing the procedure name as argument it is giving me below error may I know usage of this method.
    I am writing below code in jacl
    set stmt [$connection prepareCall "{call IOP_Dimension_Load()}"]
    where IOP_Dimension_Load is a compiled stored procedure.
    2011-01-25 15:39:01.964 NOTIFICATION executing: [invoke external script "Load_etl_tables.jacl"]
    2011-01-25 15:39:02.892 ERROR ERROR: status 2
    2011-01-25 15:39:02.892 ERROR Error while processing script C:\Oracle\IOP\custom\jacl\Load_etl_tables.jacl
    2011-01-25 15:39:02.919 ERROR Stack trace: com.interlacesystems.util.ISException: Error while processing script C:\Oracle\IOP\custom\jacl\Load_etl_tables.jacl
    at com.interlacesystems.model.ExternalScriptSupport.createISException(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.evaluate(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.evaluate(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.invoke(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.invoke(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher.invoke_clause(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher.statement(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher$ASTStatementRequest.process(Unknown Source)
    at com.interlacesystems.scope.Request.execute(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher.multistatement(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest.process(Unknown Source)
    at com.interlacesystems.scope.Request.execute(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest.executeStatement(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest$WrapperRequest.process(Unknown Source)
    at com.interlacesystems.scope.Request.execute(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest.executeStatement(Unknown Source)
    at com.interlacesystems.remoteadmin.jws.RemoteAdminSoapImpl$ExecuteCommandWork.run(Unknown Source)
    at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
    at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
    Caused by: javax.script.ScriptException: java.lang.UnsupportedOperationException;
    Stacktrace:
    tcl.lang.ReflectException
    at tcl.lang.JavaInvoke.call(JavaInvoke.java:287)
    at tcl.lang.JavaInvoke.callMethod(JavaInvoke.java:121)
    at tcl.lang.ReflectObject.cmdProc(ReflectObject.java:914)
    at tcl.lang.Parser.evalObjv(Parser.java:818)
    at tcl.lang.Parser.eval2(Parser.java:1221)
    at tcl.lang.Parser.evalTokens(Parser.java:1001)
    at tcl.lang.Parser.eval2(Parser.java:1208)
    at tcl.lang.Interp.eval(Interp.java:2222)
    at tcl.lang.Interp.eval(Interp.java:2276)
    at com.interlacesystems.util.scripting.jacl.JaclScriptEngine.eval(Unknown Source)
    at com.interlacesystems.util.scripting.jacl.JaclScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:195)
    at com.interlacesystems.model.ExternalScriptSupport.evaluate(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.evaluate(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.evaluate(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.invoke(Unknown Source)
    at com.interlacesystems.model.ExternalScriptSupport.invoke(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher.invoke_clause(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher.statement(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher$ASTStatementRequest.process(Unknown Source)
    at com.interlacesystems.scope.Request.execute(Unknown Source)
    at com.interlacesystems.compiler.ISStatementDispatcher.multistatement(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest.process(Unknown Source)
    at com.interlacesystems.scope.Request.execute(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest.executeStatement(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest$WrapperRequest.process(Unknown Source)
    at com.interlacesystems.scope.Request.execute(Unknown Source)
    at com.interlacesystems.compiler.StatementRequest.executeStatement(Unknown Source)
    at com.interlacesystems.remoteadmin.jws.RemoteAdminSoapImpl$ExecuteCommandWork.run(Unknown Source)
    at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
    at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
    in Load_etl_tables.jacl
    at com.interlacesystems.util.scripting.jacl.JaclScriptEngine.eval(Unknown Source)
    at com.interlacesystems.util.scripting.jacl.JaclScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:195)
    at com.interlacesystems.model.ExternalScriptSupport.evaluate(Unknown Source)
    ... 18 more
    Thanks,
    Sunil

    If you look at <install-root>/interlace/jacl/oracle_utils.jacl, there are enough details to see how to execute stored procedure. But these are issues, product doesnt take a particular stand on. You can execute SQL outside and sequence all the scripts (sql, isa, jacl) through shell or perl scripts. It is upto the solution designers to think through.

  • Execute a Store procedure using Database scheduler.

    Hello Experts,
    I want to create a Database schedule job that will trigger a stored procedure after say 60 mins
    Please provide any pointers or help to accomplish this.
    thanks

    Hi,
    Please try like this.....!!!
    SQL>CONN SYS/PASSWORD  AS SYSDBA;
    CONNECTED
    SQL> ED SAMPLE;
    CREATE OR REPLACE PROCEDURE SAMPLE AS
    BEGIN
    UPDATE SCOTT.EMP SET SAL= SAL+300 WHERE ENAME='ALLEN';
    COMMIT;
    END;
    SQL> ED JOB;
    declare
    begin
      DBMS_SCHEDULER.create_job (
        job_name        => 'SA',
        job_type        => 'STORED_PROCEDURE',
        job_action      => 'SAMPLE',
        start_date      => SYSTIMESTAMP,
        repeat_interval => 'freq=Hourly; INTERVAL=60',
        end_date        => NULL,
        enabled         => TRUE,
        comments        => 'Job defined entirely by the CREATE JOB procedure.');
    end;KPR

  • Execute store procedure from form

    How do I execute a store procedure from FORM
    I have a store procedure in the database
    all it does insert a value to table test.
    in 'WHEN-NEW-INSTANT-TRIGGER' of the form MODLUE I put
    test_curor; (name of the store procedure)
    The module does have block or any thing it.
    There was no syntax errors or form error
    but it did not insert into the table.
    Why????

    I just tested this myself and you are right. If you have one block with no items in it the when-new-form-instance trigger will not be fired. I got a message back saying 'block had no items', though it ran OK. This kinda makes logical sense, since there is nothing for the form to do. I put a button onto the block and the procedure fired no problem. I must admit I have never tried creating a form with no items in it so I haven't seen this behaviour before.
    Shucks you live and learn every day!

  • HOW TO EXECUTE A STORE PROCEDURE THAT RETURN MULTIPLE ROWS FROM A QUERY

    I NEED TO CREATE AND USE A STORE PROCEDURE THAT IS GOING TO DO A SELECT STATEMENT AN THE RESULT OF THE SELECT STATEMENT IS RETURN IN SOME WAY TO THE REQUESTER.
    THIS CALL IS MADE BY AN EXTERNAL LANGUAGE, NOT PL/SQL OR FORMS APPLICATION. USING FOR EXAMPLE ODBC AND VISUAL BASIC. WHAT I NEED TO DO IS ADD A DATA ACCESS LAYER TO MY APPLICATION AND I ALREADY HAVE IT DONE FOR MS SQL SERVER, BUT I NEED THE SAME FUNCTIONALITY ACCESSING AN ORACLE DATABASE.
    FLOW:
    1. VB CREATE A ODBC CONNECTION TO A ORACLE DATABASE
    2. VB EXECUTE A STORE PROCEDURE
    3. THE STORE PROCEDURE RETURNS TO THE VB APPLICATION THE RESULT OF THE QUERY THAT IS INSIDE OF THE STORE PROCEDURE.(I.E. THE STORE PROCEDURE IS A BASIC SELECT, NOTHING COMPLEX)
    4. VB DISPLAY THE RESULT IN A GRID
    FOR SURE I CAN DO THE SELECT DIRECTLY TO ORACLE, BUT FOR PERFORMANCE REASONS AND SCALABILITY, I'LL LIKE IT TO DO IT USING A STORE PROCUDURES
    IS THIS POSIBLE?, HOW?
    THANKS

    Certainly, it's possible. First, define a stored procedure that includes an OUT parameter which is a REF CURSOR. Then, call the stored procedure via ODBC omitting the OUT parameter from the list of parameters. IT will automatically be returned as a result set. Syntax for both is below...
    CREATE PROCEDURE foo (inParam in varchar2, resultSet OUT REF CURSOR )
    In ODBC:
    {call foo( 'someData' )}
    Justin

  • Execute Store procedure from derived table

    I would like to create a devired table to use in the LOV for my prompt.  Can I execute a store procedure in the defintion of the derived table instead of a sql statement ?  My store procedure is in a sql 2008 database

    Derived Table and SP are not the same. Derived table is more like a database view and is not a replacement for SP. I'd suggest you to use Derived table only if it is not possible to create a database table/view.
    Is it necessary for you to use your stored procedure as a data source? Are you trying to join it's result set to another table or view?
    You can create Materialized view in the database. Use that as a table in Universe.
    Try to use this object LOV in your prompt.

  • How to call a procedure from database executing commandButton...

    Hello.
    I´m using Jdev 10.1.3.2, I´d like to know how can I execute a procedure from database when I click a command button..??
    is that possible?
    thanks again.

    Yes, it's possible.
    Since you don't say anything about technologies you are using, I will assume ADF Business Components and JSF.
    You can write a service method in your application module - see Section 25.5 of the ADF Developer's Guide for Forms/4GL Developers
    Then, you can drag-and-drop the service method from the data control palette on to your JSF page and select ADF Command Button when you drop.
    You will, in all likelyhood, find numerous examples when you search the forum as well.
    John

  • How to execute oracle stored procedure through php as externally?

    hi...
    i am searching for the way that how to execute oracle stored procedure through web service, i am using php and mysql, i have some stored procedures in oracale database, i want to execute them, from php, means the database will be remain mysql, and the stored procedures of oracle will be executed externally...
    Kind regards,
    Wilayat.

    Ok, so first of all this is a kind of strange question. Since Oracle and MYSQL can happily live side by side.
    Make sure you have the oracle client (instant or regular ) installed and OCI_8 is set up and working correctly in PHP. If it is, when you run the phpinfo() routine you will see oci_8 on there. IF PHP connects just fine from the command line yet apache wont connect check permissions and things like the LD_Library Path.
    Then in php, right along with your MySQL statements run Oracle Statements eg:
    <?php
    $OraDB = oci_connect(name,pass,tnsname);
    $MySQLdb = mysql_connect([parms]);
    $oraQueryText = "begin sp_some_proc([some parms]); end;" ;
    $mysqlQuery = " Some mysql Query";
    $oraQuery = oci_parse($OraDB,$oraQueryText );
    oci_execute($oraQuery);
    mysql_execute([parms]);
    ?>
    Use the standard fetch code to get data from either of them.
    If you cannot and I mean absolutely cannot get an admin to link in OCI_8 then you still have recourse although it will be tedious as hell. PHP allows you to exec calls to the OS. You still MUST make sure the Oracle Client is installed and that sqlplus runs from the command line. You will more then likely have to have a shell script written to do this as well, but maybe not as I have never tried it with the exception of capturing the return value of sqlplus and you will have to dig into sqlplus to get it to send its results to a file you can then parse with php.
    Good Luck!

  • 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?

  • Error ORA-04031 while executing a stored procedure from Pro C++ code

    I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
    Does anyone know why it is happening and any possible solutions?
    TIA
    Srithaj.

    One thing that can be done is to flush the shared pool before starting the application.
    alter system flush shared pool;
    Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
    null

  • Invoking Oracle stored procedures from within a JDBC channel for PI 7.1

    Hi ,
    Can anybody tell me that is it possible to invoke Oracle stored Procedure from within a JDBC  sender channel for PI 7.1.
    Its working in XI3.0 and XI 7.0 for Oracle DBMS versions >= 10.2.x. But I am not sure,whether it will work for PI 7.1 also.
    Thanks & Regards,
    Saru

    HI,
    refer below link,there is no much difference in PI7.1 ,executing stored procedure is same .
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/7b72b2fde93673e10000000a114a6b/content.htm
    Regards,
    Raj

Maybe you are looking for