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!

Similar Messages

  • How to execute oracle stored procedure parallely.

    dear all,
    i am having a stored procedure in oracle that i run to 2000 times for different solids.
    if i am executing this in one by one  it is taking 6 hour to finish. eg. first it will execute for 1 sol and then start for 2nd sol.
    instead of doing this; i want to run this parallely in multithreding; so that procure will run parallely for 50 sol.
    please guide.
    regards
    munish

    something like:
    declare
      job_num number;
    begin
      job_num := dbms_job.submit('proc('||1||')');
      job_num := dbms_job.submit('proc('||2||')');
      job_num := dbms_job.submit('proc('||1999||')');
      job_num := dbms_job.submit('proc('||2000||')');
      commit;
    end;
    At the commit all 2000 jobs will be submitted to the job queue. They will then run is as many as the database parameter job_queue_processes allows.
    You can then monitor user_jobs to see when they are running, and finishing.
    Of course you might be better of calling the procedure once and doing everything in one go, by maximising the power of SQL, but I have not idea what your procedure does or what a solid might be.

  • Can sqltaglib.tld execute Oracle stored procedure?

    Is it possible to execute Oracle stored procedure through Oralce's own sqltaglib.tld. The sqltaglib on-line manual only shows how to run SQL query/insert/update statement.
    Thanks,

    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);

  • Calling Oracle Stored Procedure through COBOL

    I am calling a Oracle Stored Procedure through COBOL program. Here is the procedure that is in Oracle.
    PROCEDURE sp_sel_m_event_subs_profile (
    eventID IN EventIDTyp,
    subscribed IN NUMBER,
    v_profileRef OUT profileRefWithDSID_cv
    IS
    BEGIN
    sp_check_event_id(eventID);
    OPEN v_profileRef FOR
    SELECT
    sub.profile_i,
    ref.datasource_i,
    ref.primary_key_x
    FROM
    ccf_event_subscribe sub,
    ccf_profile_reference ref
    WHERE
    sub.event_i = eventID
    AND
    sub.is_subscribed_i = subscribed
    AND
    sub.profile_i = ref.profile_i;
    END sp_sel_m_event_subs_profile ;
    So while trying to call this procedure in COBOL program I am getting error as wrong number or types of arguments in call to 'SP_SEL_M_EVENT_SUBS_PROFILE'
    Here is the call statement in COBOL. I tried with many other options by adding some more fields but did not work.
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    (:EVENT-I, :SUBSCRIBED);
    END;
    END-EXEC
    Please someone let me know how should I pass arguments EVENT-I and SUBSCRIBED to this Procedure so that I will get PROFILE-I, DATASOURCE-I and PRIMARY-KEY-X
    Note: The above procedure is working good by other software. But there is no example as How to use Call statement through COBOL.
    Thanks

    Here is the cobol declaration of each variable.
    01 EVENT-I PIC X(06) VALUE SPACES.
    01 SUBSCRIBED PIC 9(01) VALUE ZEROS.
    01 PROFILE-I PIC X(08) VALUE SPACES.
    01 DATA-SRC-I PIC X(08) VALUE SPACES.
    01 PRIMARY-KEY-X PIC X(08) VALUE SPACES.
    I tried with this layout, but still not working
    01 EVENT-I PIC 9(06) VALUE ZEROS.
    01 SUBSCRIBED PIC 9(01) VALUE ZEROS.
    01 PROFILE-I PIC 9(08) VALUE ZEROS.
    01 DATA-SRC-I PIC 9(08) VALUE ZEROS.
    01 PRIMARY-KEY-X PIC 9(08) VALUE ZEROS.
    Here are some of them I tried.
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :EVENT-I
    , :SUBSCRIBED
    , :PROFILE-I);
    END;
    END-EXEC
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :EVENT-I
    , :SUBSCRIBED
    , :PROFILE-I
    , :DATA-SRC-I
    , :PRIMARY-KEY-X);
    END;
    END-EXEC
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :EVENT-I
    , :SUBSCRIBED );
    END;
    END-EXEC
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :PROFILE-I
    , :DATA-SRC-I
    , :PRIMARY-KEY-X);
    END;
    END-EXEC

  • How to call oracle stored procedure

    how to call oracle stored procedure using
    jdevloper.can any one help?
    thanks
    pullareddy

    Connection conn =
    DriverManager.getConnection("your connect string");
    CallableStatement stm=conn.prepareCall( "{?=call getDeptName(?)}");
    stm.registerOutParameter(1,OracleTypes.VARCHAR);
    int deptno=10;
    stm.setInt(2,deptno);
    stm.execute();
    String dname=stm.getString(1);
    stm.close();
    conn.close();
    getDeptName is a function:
    FUNCTION
    getDeptName(id IN NUMBER) RETURN VARCHAR2...

  • How to call Oracle Stored Procedure using EDQ

    Can someone tell me how to use Oracle Stored Procedure call in EDQ, sample scripts/steps will be really helpful. Thanks!

    It is also possible to do this using a custom processor in EDQ. The processor needs to do something very similar to the external task above (opens a DB connection, authenticates, runs a stored procedure).
    If you need this, please talk us through the use case so we can determine if it is the best fit. In some ways, an external task is better as logically a stored procedure call is normally divorced from any process logic in EDQ.
    Regards,
    Mike

  • 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

  • How to execute a stored procedure/function in TOAD?

    Hi, All ,
    Can someone please tell me how to execute a stored procedure/function in TOAD?
    I have tired
    EXECUTE PROCEDURENAME(888), but it doesn’t work.
    TOAD give me the error: invalid SQL statement.
    Thanks a lot

    Write PL/SQl block.
    i.e Begin
    Procedure name..
    end;
    Then it will be excuted.
    Ashutosh

  • How to execute a stored procedure every 5 minutes in biztalk admin console

    Hi 
    how to execute a stored procedure every 5 minutes in biztalk admin console without using biztalk orchestration
    we need to update table data every 5minutes 
    please replay asap...........
    thanks advance....

    WCF adapter is best suited for the same. Use ‘Template’ feature of WCF adapter. Template is mainly used to add wrapper elements around the body of the outgoing message from send port.
    Below mentioned post is perfectly suited for you.
    http://social.technet.microsoft.com/wiki/contents/articles/19845.invoke-a-sql-stored-procedure-on-the-biztalk-wcf-send-port-without-needing-an-orchestration.aspx
    Regards,
    Rachit
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Error while executing Multiple Stored Procedure through .sql file

    Hi Guru's.
    I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
    I have one test.sql file with Stored Procedure is like,
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton1');
    END skeleton1;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton2');
    END skeleton2;
    Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
    I am opening test.sql file from SQL PLUS,
    SQL>
    1 CREATE OR REPLACE PROCEDURE skeleton1
    2 AS
    3 BEGIN
    4 DBMS_Output.Put_Line('skeleton1');
    5 END skeleton1;
    6 /
    7 CREATE OR REPLACE PROCEDURE skeleton2
    8 AS
    9 BEGIN
    10 DBMS_Output.Put_Line('skeleton2');
    11* END skeleton2;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> show errors;
    Errors for PROCEDURE SKELETON1:
    LINE/COL ERROR
    6/1 PLS-00103: Encountered the symbol "/"
    SQL>
    Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
    Regards,
    Shatrughan

    Hi,
    Try this
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton1');
    END ;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton2');
    END;
    /Save the file and call it.
    Regards,
    Bhushan

  • How to call oracle stored procedure with OUT parameter?

    I create oracle stored procedure in eclipse oepe
    PROCEDURE SP_SELECT_ORA (
    ID_INPUT IN VARCHAR2,
    ID_OUTPUT OUT VARCHAR2,
    PASSWD_OUTPUT OUT VARCHAR2,
    NAME_OUTPUT OUT VARCHAR2) IS
    BEGIN
    SELECT EMP_ID, EMP_Passwd, EMP_Name
    INTO ID_OUTPUT, PASSWD_OUTPUT, NAME_OUTPUT
    FROM family
    WHERE EMP_ID = ID_INPUT;
    END;
    and I try to call the sp in jpa like below,
    @NamedNativeQueries({
         @NamedNativeQuery(name = "callSelectSP", query = "call SP_SELECT_ORA(?,?,?,?)", resultClass = Members.class)
    @Entity
    @Table(name="family")
    public class Members implements Serializable {
         @Id
         @Column(name = "EMP_ID")
         private String ID;
         @Column(name = "EMP_Passwd")
         private String Passwd;
         @Column(name = "EMP_Name")
         private String Name;
    ==============
    @PersistenceContext(unitName="MyFamily")
         EntityManager em;
    query = em.createNamedQuery("callSelectSP");
         query.setParameter(1, ID);
         String id_output = null;
         String passwd_output = null;
         String name_output = null;
         query.setParameter(2,id_output);
         query.setParameter(3,passwd_output);
         query.setParameter(4,name_output);
         query.executeUpdate();
         member = (Members)query.getSingleResult();
    But this query throws exception,
    19:55:35,500 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) SQL Error: 1465, SQLState: 72000
    19:55:35,500 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) ORA-01465: invalid hex number
    I don't know how. Pls, give me your advice. Thanks in advnace.
    Best regards

    Thank you for your reply, Chris!
    I tried this one.
    @NamedNativeQueries({
    @NamedNativeQuery(name = "callSelectSP", query = "exec SP_SELECT_ORA( ?, :id_output, :passwd_output, :name_output) " , resultClass = Members.class)
    @Entity
    @Table(name="family")
    public class Members implements Serializable
    ===================
    query = em.createNamedQuery("callSelectSP");
    query.setParameter(1, ID);
    String id_output = null;
    String passwd_output = null;
    String name_output = null;
    query.setParameter("id_output", id_output);
    query.setParameter("passwd_output", passwd_output);
    query.setParameter("name_output",name_output);
    query.executeUpdate();
    On Console hibernate shew the sql and ora # like below,
    19:59:25,160 INFO [stdout] (http--127.0.0.1-8080-1) Hibernate: exec SP_SELECT_ORA( ?, ?, ?, ?)
    19:59:25,192 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) SQL Error: 900, SQLState: 42000
    19:59:25,192 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) ORA-00900: Invalid SQL statement
    Pls, inform me your advice. Thanks in advance.
    Best regards.

  • Execute oracle stored procedure in CF8

    I am executing a stored procedure like this.
    <cfstoredproc procedure="GetAction"
    datasource="test_DSN">
    <cfprocparam cfsqltype="CF_SQL_INTEGER"
    dbvarname="actionId" type="in" value="1">
    <cfprocresult name="actions" resultset="1" >
    </cfstoredproc>
    and my stored procedure in oracle is,
    create or replace function GetAction(actionId IN
    ACTION.ID%TYPE)
    RETURN ACTION%ROWTYPE
    IS
    actions
    ACTION%ROWTYPE;
    begin
    select *
    INTO actions
    FROM ACTION WHERE ID = actionId;
    RETURN actions;
    end GetAction;
    then I get the error message like,
    ORA-01008: not all variables bound
    Please help me on this.
    Thanx

    If you want to return a result set (result of a query) from
    your PL/SQL, you will have to do what Daverms suggested and convert
    your function to a procedure
    and use a reference cursor to return your result set. Your
    procedure will have to be contained in a package in order for you
    to declare a ref cursor "globally" so that it can be accessed by
    CF.
    Oh, and be sure to change your cfstoredproc procedure
    parameter to add the package name to the proc name.
    <cfstoredproc procedure="your_pkg.GetAction"
    datasource="test_DSN">
    Phil

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

  • How to execute an Stored procedure in SQLDeveloper?

    Hi
    Thank you for reading my post
    I want to know how i can execute an Stored procedure in SQL developer 1.1.0.21
    for example those sotred procedure from HR schema.
    one of them is add_job_history
    when i click on it and select run i see a new dialog with some sql as follow:
    DECLARE
      P_EMP_ID NUMBER;
      P_START_DATE DATE;
      P_END_DATE DATE;
      P_JOB_ID VARCHAR2(10);
      P_DEPARTMENT_ID NUMBER;
    BEGIN
      P_EMP_ID := NULL;
      P_START_DATE := NULL;
      P_END_DATE := NULL;
      P_JOB_ID := NULL;
      P_DEPARTMENT_ID := NULL;
      HR.ADD_JOB_HISTORY(
        P_EMP_ID => P_EMP_ID,
        P_START_DATE => P_START_DATE,
        P_END_DATE => P_END_DATE,
        P_JOB_ID => P_JOB_ID,
        P_DEPARTMENT_ID => P_DEPARTMENT_ID
    END;I checked the help and it said i should replace =>P_emp_id with some number
    I did that and i get error.
    can some one give me a sample for executing this procedure?
    thanks

    Remove the NULL values with the data you want to use in the SP.
    BEGIN
    P_EMP_ID := 32;
    P_JOB_ID := 'boss';
    For the date you have to chose the approriate string....

  • How to invoke Oracle stored procedures in Web Intelligence Custom SQL ?

    Hi,
    Referring to some older posts, I see that there is a work around to invoke a stored procedure to return results for a Web Intelligence report. Its been posted for calling a MS SQL stored proc, whereas the mentioned method does not seem to work for an Oracle Stored Procedure.
    Steps I followed:
    a) This is the parameter I have added in the oracle.sbo file => <Parameter Name="Force SQLExecute">Procedures</Parameter>
    b) My stored procedure code is as follows:
    CREATE OR REPLACE PROCEDURE get_emp_details(var_first_name OUT VARCHAR) AS
    BEGIN
    SELECT first_name INTO var_first_name
    FROM EMP_DETAILS_VIEW
    WHERE EMPLOYEE_ID = 100;
    END;
    c) Custom SQL code I added in my Webi report:
    set nocount on;
    /* SELECT
    EMP_DETAILS_VIEW.FIRST_NAME
    FROM
    EMP_DETAILS_VIEW
    exec get_emp_details;
    On trying to validate the SQL it gives me the following error message: "The SQL query has 0 instead of 1 columns.(WIS 10810)"
    Has anyone been able to successfully call an Oracle Stored procedure using the above method ?
    Version of BO: XI R3 SP2
    Oracle version: 11gR2
    PS: I am aware that web intelligence since XI R3.1 does allow use of a dedicated Stored Procedure Universe. I would want to know if it could
    be made to run in a normal Universe(not a stored procedure Universe)
    Thanks for your time and inputs.
    Regards,
    Jez

    EXECUTE is a SQL Plus command. You can directly call SP in PL/SQL
    DECLARE
        modif number;
    BEGIN
    select data_length into modif from user_tab_columns where table_name='CONTROL' and column_name='POSITION';
    IF modif < 10 THEN
        droptable('CONTROL');
        execute immediate('CRETAE TABLE CONTROL ....';
    ...

Maybe you are looking for

  • Table for MM (Purchase- ME23N) Tax

    Hi friends, In my Report, I have to calculate & Display,  Material Purchase taxes. ( In ME23N --> Item --> Invoice -->Taxes AND ME23N --> Item -->Conditions) Can I have any Condition table for this entries (Like for SD & CS we have transparant table

  • WebUtil on Linux is not working

    Hi All, I have install app server 10.1.2.0.2 and configured the webuitl on linux ES4. I am trying to use client_text_io command it is not working. It is not even giving any errors. Please help me to find the problem. Thanks,

  • Plain SQL Conditional WHERE Clause with two sub-selects

    Hi SQL Experts, I need a bit quick of help with a query. This is a "select" statement for an OBI repository phyiscal table source object. So I cant put PL/SQL or Stored Procedures in it. I just need to have two different conditions/selects depending

  • Mail preferences panels disappeared

    Hi Helpers! First: I'm using two system languages with my mac, German and Norwegian. The problem I've got ONLY happens, while the language is German! The Problem: When starting the Preferences of Mail, there are no panels like "general", "accounts" o

  • Restoring controlfile from rman

    Hi Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on OEL4 I have lost all the control files (infact deleted knowingly to simulate ). i have a full database backup in recovery catalog. I do not know the dbid of database. I am not able to co