Calling packaged stored procedure from php fails

The following php fails with:-
Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SPMEMBERDETAILS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in C:\Program Files\Apache Group\Apache2\htdocs\KioskCurrent\GM2.php on line 28
Cannot Execute statement
<?php
$number = "2100418933";
// Connect to database...
$conn=OCILogon("big", "big");
if ( ! $conn ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
$cursor = OCINewCursor($conn);
$stmt = OCIParse($conn, "BEGIN spPackage.spMemberDetails(:number, :cv_memberdetails); END;")
or die('Cannot parse query');
OCIBindByName($stmt, ":cv_memberdetails", &$cursor)
or die('Cannot bind array variable');
OCIBindByName($stmt, ":number", &$number)
or die('Cannot bind number variable');
$exec = OCIExecute($stmt)
or die('Cannot Execute statement');
OCIExecute($cursor);
while ($data = OCIFetchInto($cursor)) {
var_dump($data);
OCIFreeStatement($stmt);
OCIFreeCursor($cursor);
OCILogoff($conn);
?>
and the stored procedure looks like
SQL> desc sppackage;
PROCEDURE SPGETMEMBERNUMBER
Argument Name Type In/Out Default?
P_NUMBER VARCHAR2 IN
P_MEMBERNUMBER VARCHAR2 OUT
PROCEDURE SPGETSLOTSHANDLE
Argument Name Type In/Out Default?
P_HANDLE NUMBER(15,2) OUT
P_NUMBER VARCHAR2 IN
P_STARTDATE VARCHAR2 IN
P_ENDDATE VARCHAR2 IN
PROCEDURE SPGETTABLEHANDLE
Argument Name Type In/Out Default?
P_HANDLE NUMBER(15,2) OUT
P_NUMBER VARCHAR2 IN
P_TABLEGAMEPREFIX VARCHAR2 IN
P_STARTDATE VARCHAR2 IN
P_ENDDATE VARCHAR2 IN
PROCEDURE SPMEMBERDETAILS
Argument Name Type In/Out Default?
P_NUMBER VARCHAR2 IN
CV_MEMBERDETAILS REF CURSOR OUT
RECORD OUT
R_MEM_NUMBER VARCHAR2(12) OUT
R_MEM_SNAME VARCHAR2(25) OUT
R_MEM_FNAME VARCHAR2(25) OUT
R_MEM_TITLE VARCHAR2(25) OUT
PROCEDURE SPTABLESPLAYED
Argument Name Type In/Out Default?
P_NUMBER VARCHAR2 IN
P_STARTDATE VARCHAR2 IN
P_ENDDATE VARCHAR2 IN
CV_TABLESPLAYED REF CURSOR OUT
RECORD OUT
Please tell me what I have done incorrect.

I would guess it is something to do with not binding all the OUT variables, it seems you have only binded the OUT cursor? For more details calling Stored Procedures see
http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_sps.html

Similar Messages

  • Calling packaged stored procedure from Java

    Hi All,
    I'm trying to call a stored procedure from Java but I'm having
    problems with registrating the output parameter. I'm getting
    the error: Conflicting parameters.: sqltype=2003
    This is the stored procedure which is located in a package in
    the Oracle database:
    package Pack_GetAgencyInformation as
    Type InfoType is record ( agen_code varchar(3), agen_designation
    varchar(30), agen_adresse varchar(60), agen_tel varchar(12) );
    function GetAgencyInformation( P_AGENCE VARCHAR )
    return Pack_GetAgencyInformation.InfoType
    end Pack_GetAgencyInformation;
    This is the Java source from where I'm calling the procedure:
    //DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
         Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@164.48.69.125:1521:ventes", "system", "*****
    // @machineName:port:SID,
    userid, password
    CallableStatement cs = conn.prepareCall("{ ? = call
    Pack_GetAgencyInformation.GetAgencyInformation( ? )}");
         try {
              cs.registerOutParameter( 1,
    oracle.jdbc.driver.OracleTypes.ARRAY);
         } catch (SQLException e) {
              e.printStackTrace();
         cs.setString(2, "001" );
         //ResultSet rset = cs.executeQuery();
    The stacktrace:
    java.sql.SQLException: Parametertypen conflicteren.:
    sqlType=2003
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:210)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:220)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:350)
    at dbAccess.main(dbAccess.java:25)
    I think it has to do with the type InfoType which is created in
    the Stored Procedure. I'm absolute no Oracle expert and I
    prefer not to make changes to the Oracle database. So any
    solution in Java is welcome!
    BR, H.Rietman

    I managed to get it to work only by changing the stored
    procedure. I have changed the return type record to a Ref
    Cursor type (had to change alot of code for this). It seams
    that Oracle JDBC drivers DON'T support the Record type as a
    return type.
    So the next question is: is it possible to typecast a record
    type to a ref cursor type in Oracle. In this way I can easily
    change the return type for the stored procedures.
    /Harald

  • Calling stored procedure from php script.

    I have the following stored procedure in Oracle 8:
    CREATE OR REPLACE procedure kunde_create
    (iname1 in varchar2,
    iname2 in varchar2,
    iname3 in varchar2,
    ianrede in number,
    istrasse in varchar2,
    iland varchar2,
    iplz in varchar2,
    iort in varchar2,
    iortsteil in varchar2,
    itelefon in varchar2,
    iemail in varchar2,
    itelefax in varchar2,
    imobil in varchar2,
    ianrufer in varchar2,
    izusinfo in varchar2,
    izusatz2 in varchar2,
    okdnr out varchar2)
    is
    vkndnr number;
    vadrnr number;
    vkdnr varchar2(15);
    ikugru constant number:=4;
    minkdnr constant varchar2(15):='44000000';
    maxkdnr constant varchar2(15):='50000000';
    begin
    ..... SOME CODE ....
    okdnr:='something_to_output';
    commit;
    end kunde_create;
    I am trying to call this SP from a php script, in this way:
    $connection = ora_logon("username@db", "password");
    $cursor = ora_open($connection);
    ora_commitoff($connection);
    $cu=ora_parse($cursor, "begin KW.kunde_create ( :Sta_nameD, :Sta_name2D, :Sta_kugruD, :ianredeD, :Sta_straD, :Sta_landD, :Sta_plzD, :Sta_ortD, :Sta_ortsteilD, :Sta_telD, :Sta_mailD, :Sta_faxD, :Sta_tel2D, :Sta_anruD, :Sta_zusD, :Sta_zus2D ,:okdnr); end;");
    ora_bind($cursor, ":Sta_nameD", $Sta_nameD, 32, 1);
    ora_bind($cursor, ":Sta_name2D", $Sta_name2D, 32, 1);
    ora_bind($cursor, ":ianredeD", $ianredeD, 32, 1);
    ora_bind($cursor, ":Sta_straD", $Sta_straD, 32, 1);
    ora_bind($cursor, ":Sta_landD", $Sta_landD, 32, 1);
    ora_bind($cursor, ":Sta_plzD", $Sta_plzD, 32, 1);
    ora_bind($cursor, ":Sta_ortD", $Sta_ortD, 32, 1);
    ora_bind($cursor, ":Sta_ortsteilD", $Sta_ortsteilD, 32, 1);
    ora_bind($cursor, ":Sta_telD", $Sta_telD, 32, 1);
    ora_bind($cursor, ":Sta_mailD", $Sta_mailD, 32, 1);
    ora_bind($cursor, ":Sta_faxD", $Sta_faxD, 32, 1);
    ora_bind($cursor, ":Sta_tel2D", $Sta_tel2D, 32, 1);
    ora_bind($cursor, ":Sta_anruD", $Sta_anruD, 32, 1);
    ora_bind($cursor, ":Sta_zusD", $Sta_zusD, 32, 1);
    ora_bind($cursor, ":Sta_zus2D", $Sta_zus2D, 32, 1);
    ora_bind($cursor, ":okdnr", $okdnr, 32, 2);
    ora_exec($cursor); //Line 93
    This code brings me back this error:
    Warning: Can't find variable for parameter in /www/vaillant/htdocs/www_tisweb/html/php/testdb/connect.php on line 93
    I tried nearlly everything, but it doesnt work :(
    Can anybody help me please.
    Thanx in advance,
    Ahmed Adaileh

    I had to make a few modifications to get your example to work. The
    biggest change was to the ora_bind syntax. I also found I had to
    define a variable to hold the OUT value before doing the ora_exec.
    Otherwise I got the error you saw. I'm not sure why defining it first
    is necessary. I didn't dig deeply into PHP's oracle.c code.
    My final script is below. It displays "okdnr is something_to_output".
    I tested using PHP 4.3.3 against Oracle 9.2.
    The best general suggestion I can make is to use PHP's oci8 driver
    unless you need to be compatible with existing PHP code. There is an
    example of using OUT binds in oci8 to call a stored procedure at
    PHP and serveroutput
    -- CJ
    <?php
    // Changed connection details to suit my environment
    $connection = ora_logon("scott@MYDB", "tiger");
    $cursor = ora_open($connection);
    ora_commitoff($connection);
    // Changed schema to SCOTT to match who I'd created the procedure as
    $cu=ora_parse($cursor, "begin SCOTT.kunde_create ( :Sta_nameD, :Sta_name2D, :Sta_kugruD, :ianredeD, :Sta_straD, :Sta_landD, :Sta_plzD, :Sta_ortD, :Sta_ortsteilD, :Sta_telD, :Sta_mailD, :Sta_faxD, :Sta_tel2D, :Sta_anruD, :Sta_zusD, :Sta_zus2D ,:okdnr); end;");
    // Allocated the IN parameter variables
    $Sta_nameD      = 'a';
    $Sta_name2D     = 'a';
    $ianredeD       = 1;
    $Sta_straD      = 'a';
    $Sta_landD      = 'a';
    $Sta_plzD       = 'a';
    $Sta_ortD       = 'a';
    $Sta_ortsteilD  = 'a';
    $Sta_telD       = 'a';
    $Sta_mailD      = 'a';
    $Sta_faxD       = 'a';
    $Sta_tel2D      = 'a';
    $Sta_anruD      = 'a';
    $Sta_zusD       = 'a';
    $Sta_zus2D      = 'a';
    $Sta_kugruD     = 'a';
    // Changed ora_bind syntax to match
    // http://www.php.net/manual/en/function.ora-bind.php
    ora_bind($cursor, "Sta_nameD", ":Sta_nameD", 32, 1);
    ora_bind($cursor, "Sta_name2D", ":Sta_name2D", 32, 1);
    // Change ianredeD type to 2 to match procedure definition
    ora_bind($cursor, "ianredeD", ":ianredeD", 32, 2);
    ora_bind($cursor, "Sta_straD", ":Sta_straD", 32, 1);
    ora_bind($cursor, "Sta_landD", ":Sta_landD", 32, 1);
    ora_bind($cursor, "Sta_plzD", ":Sta_plzD", 32, 1);
    ora_bind($cursor, "Sta_ortD", ":Sta_ortD", 32, 1);
    ora_bind($cursor, "Sta_ortsteilD", ":Sta_ortsteilD", 32, 1);
    ora_bind($cursor, "Sta_telD", ":Sta_telD", 32, 1);
    ora_bind($cursor, "Sta_mailD", ":Sta_mailD", 32, 1);
    ora_bind($cursor, "Sta_faxD", ":Sta_faxD", 32, 1);
    ora_bind($cursor, "Sta_tel2D", ":Sta_tel2D", 32, 1);
    ora_bind($cursor, "Sta_anruD", ":Sta_anruD", 32, 1);
    ora_bind($cursor, "Sta_zusD", ":Sta_zusD", 32, 1);
    ora_bind($cursor, "Sta_zus2D", ":Sta_zus2D", 32, 1);
    // Changed okdnr type to 1 to match procedure definition
    ora_bind($cursor, "okdnr", ":okdnr", 32, 1);
    // Bound missing parameter
    ora_bind($cursor, "Sta_kugruD", ":Sta_kugruD", 32, 1);
    // Preallocated the output variable - I'm not sure why this is
    // necessary nor what size is needed.
    // When this line is commented out I get:
    //   Warning: Can't find variable for parameter in test01.php on line XX
    $okdnr = "a";
    ora_exec($cursor);
    print "okdnr is $okdnr";
    ?>

  • Calling a stored procedure from a url

    I am needing to call a stored procedure from a url string (or
    anchor) understand that from training to be as follows:
    http://host:port/pls/dad/package.procedure?query_string
    With that in mind, I am getting an error as follows:
    Not Found
    The requested URL /pls/portal30/at_hrfm.checkshow.showcheck was
    not found on this server.
    Here is a sample of my url
    http://servername:port/pls/portal30/at_hrfm.checkshow.showcheck
    I can see servername:port/pls/portal30, it is just the
    procedure I am having a problem with.
    Here is a sample of my source code that is created under the
    at_hrfm schema (I also tried under portal30 schema).
    package body checkshow as
    procedure showcheck as
    begin
    htp.htmlOpen;
    htp.headOpen;
    htp.title('My Check');
    htp.comment ('This should be your Check');
    htp.bodyOpen;
    htp.header (1,'Check');
    htp.print ('checkdate');
    htp.bodyClose;
    htp.headClose;
    htp.htmlClose;
    end;
    end;

    I think I figured this out. I don't think the grant to ANONYMOUS is going to work with production XE and the online documentation is in need of an update. It appears that production XE has been locked down and you will need to specify the name of each stored procedure you wish to allow to be executed by adding it to the WWV_FLOW_EPG_INCLUDE_MOD_LOCAL function. This is spelled out in more technical detail here: http://download.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25309/adm_wrkspc.htm#BEJCGJFJ
    Another alternative that would work involves creating a separate DAD. Using the DAD approach with my schema made all of my stored procedures callable from a web browser, so I rejected this approach. To make this usable (secure) I would have needed to create and maintain a separate database user for the DAD and then only granted it execute for the stored procedures I wanted to be callable from a URL.
    Finally I read about using an on-demand procedure and having it invoke the desired stored procedure. While I didn't try this out, it sounds like another good approach because it maintains session security. If it can be used to return an image I do not know.
    - Jim

  • Strange download size of on calling packaged stored procedure in VB6

    Hi,
    I tried to use VB6 to call oracle stored procedure with ref cursor as output parameter under a package in 10g database (10.1.03). Oracle client uses windows 9.2 / 10.1.02 (Oracle OLEDB Provider) . I found that when the package size increases(> 1000 lines codes), the data size transfer from database to VB client also increases. I try to trap the binary data flow between VB6 and database when calling packaged stored procedure. I found that VB6(or oracle client ??) will first download package spec then execute the requested stored procedure. This may explain the cause of increasing size.
    However, this large download size for calling only one of the procedure will make my application run slowly when my application uses the package much. How can I solve this problem ? Does this relate to oracle client(p.s. this problem disappear when using Microsoft OLEDB Provider)?
    Thanks
    Steven

    You can use a wrapper to get compiled code and if it's 10g you can do even more by putting it in a library.
    OLEDB from VB6 still using Oracle 'Client' as you call Oracle NET.

  • How to call a stored procedure from WorkShop

    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

    Atahualpa--
    Maybe this will help:
    http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
    Eddie
    Atahualpa wrote:
    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

  • Calling a stored procedure from within a ViewObject

    Is it possible to make stored procedure call from within a BC4J ViewObject? Basically something like this:
    select * from table(f1(3)); where f1 is a table function. Using Oracle's pipelined table functions?
    If not, is it possible to call a stored procedure from Java and have the returned results be put back into a BC4J RowSet.
    In addition, is there a way to create a JDBC Resultset from a BC4J RowSet?
    We need to be able to dynamically create our SQL statements (the entire SQL, not just the where clause) but are required to have these sql statements generated/executed from within a pl/sql stored procedure in the database.

    Is it possible to make stored procedure call from within a BC4J ViewObject? Basically something like this:
    select * from table(f1(3)); where f1 is a table function. Using Oracle's pipelined table functions?
    Yes. Using our expert-mode query feature this is possible.
    is it possible to call a stored procedure from Java and have the returned results be put back into a BC4J RowSet.
    Yes. See this article about basing a view object on a REF CURSOR:
    http://radio.weblogs.com/0118231/2003/03/03.html
    In addition, is there a way to create a JDBC Resultset from a BC4J RowSet?
    No. Not directly. What's the business requirement here so I can understand better?
    We need to be able to dynamically create our SQL statements (the entire SQL, not just the where clause) but are required to have these sql statements generated/executed from within a pl/sql stored procedure in the database.
    REF CURSOR would work fine, or if it's just the statement that needs to be generated dynamically, you could fetch the text of the SQL statement from the stored procedure, then use createViewObjectFromQueryStmt(). Although this has runtime overhead involved with describing the query.
    The REF CURSOR based approach is probably best for this.

  • Calling Oracle Stored Procedure from BC4J JSP App

    I am on an extremely tight deadline and am trying to get my JSP application to use an Oracle Stored Procedure. I need to take some input from the user and send these values as parameters. Has anyone worked with Stored Procedures in JDev3.1? Please reply with some sample code if possible.
    Thanks.

    Hi,
    Someone posted a similar request the other day. Here is my response to them:
    Basically, you need to create a custom method from your JSP's ViewObject, which calls the stored procedure. You can then call the ViewObject's custom method from the JSP client.
    Here is how I have done it:
    1. Choose the ViewObject that your JSP is based on and choose 'Edit' from the context menu.
    2. On the Java tab of the ViewObject wizard, choose Generate Java File checkbox for the View Object Class and click the Finish button. A file is created under the ViewObject node in the Navigator named 'viewobjectImpl.java'.
    3. Open the viewobjectImpl.java file in the code editor and create a method to call your stored procedure (see sample code below).
    4. Compile the VOImpl.java file.
    5. Choose the view object again, and choose Edit again from the context menu.
    6. On the Client Methods tab, you should now see your method appear in the Available field. Select it and shuttle it to the Selected field.
    7. Click Finish to leave the VO wizard, and rebuild your Business Components project.
    8. In your JSP, call the custom method (see sample code below).
    sample code for custom method calling a stored procedure from VOImpl.java file:
    public int getTotalHits(String mon, String year) {
    CallableStatement stmt = null;
    int total;
    // the call to the PL/SQL stored proc
    String totalhits = "{? = call walkthru.total_hits(?,?)}";
    // use the AM conxn 2 call storedproc
    stmt = getDBTransaction().createCallableStatement(totalhits, 1);
    try
    // Bind the Statement Parameters and //Execute this Statement
    stmt.registerOutParameter(1,Types.INTEGER);
    stmt.setString(2,mon); stmt.setString(3,year);
    stmt.execute();
    total = stmt.getInt(1);
    catch (Exception ex)
    throw new oracle.jbo.JboException(ex);
    finally
    try
    stmt.close();
    catch (Exception nex)
    return total;
    sample render code for calling custom method from JSP custom bean:
    public void render() {
    int totalhits;
    try
    Row[] rows;
    // Retrieve all records by default, the qView variable is defined in the base class
    qView.setRangeSize(-1);
    qView.first();
    rows = qView.getAllRowsInRange();
    // instantiate a view object for our exported method
    // and call the stored procedure to get the total
    ViewObject vo = qView.getViewObject();
    wtQueryView theView = (wtQueryView) vo;
    totalhits = theView.getTotalHits(session.getValue("m").toString(),session.getValue("y").toString());
    out.println(totalhits);
    } catch(Exception ex)
    throw new RuntimeException(ex.getMessage());
    }

  • Calling Oracle Stored Procedure from Weblogic.

    Hi All,
    I am using Oracle 11g R2 and weblogic 10.3.5.0
    Do you know if it is possible to call a stored procedure from Weblogic.
    Basically, what I would like to do is to call the following procedure : EXEC DBMS_SESSION.SET_IDENTIFIER('provider_a') when my application connects to my database, "provider_a" being the user used to connect to the oracle schema.
    Thanks.

    Up !
    Thanks.

  • Can i call a stored procedure from OracleDashboardPrompt?

    Hi,
    Can i call a stored procedure from OracleDashboardPrompt once i click the Go button in OBIEE?The input parameters to the procedure are the one that i have given in DashboardPrompt.and based on the result of the procedure(either 0 or 1),i have to display reports.Can anyone help me.
    Thanks in Advance...

    Please find below the possible approach to the scenario:
    1.Create a prompt for the column which you need as input to store proc and create a presentation variable for that .
    2.Create a dummy report with 1 column which will have the above created presentation variable as filter(We can design this reports in such a way like the first column will get filtered based on the presentation variable)
    3.Create a second column and in the column definition we can add a code like
    evaluate('StoreProc(%1)','@{firstcolumn}')
    4.We can hide the first column in the report and only show the output of store proc to the end user
    Hope this helps :)

  • Can we call a stored procedure from a Trigger

    Hello Everyone,
    I need some help in writing the triggers in Oracle 10g Database.
    Can we call a stored procedure from a trigger?

    Can we call a stored procedure from a trigger? Yes. Why did you think we couldn't?
    Cheers, APC

  • Calling invalid stored procedure from java

    Will the stored procedure which is invalid get re-compiled automatically when called from a java program?
    1.a stored procedure is invalid (oracle 9i)
    2.calling the stored procedure from a java program
    3.what will happen a.oracle recompiles the stored procedure
    b.returns an sql exception
    what happens,kindly help
    drop your mail to [email protected]
    Keep Smiling and Mailing,
    Vijay Anand Natesan.

    thank you ..Kindly let me know if any of your friends have tried this

  • Trying to call a stored procedure from C# (and failing)

    Hi;
    Two questions on this. The first is - is there a way to call a stored procedure, including passing paramaters, where the entire request is in a single string? I ask because our app lets users enter any select and so if we have to break out the parameters, then we will have to parse their select string and I worry that we will miss some of the select syntax and not always parse the select correctly.
    Second, the following is telling me:
    System.Data.OracleClient.OracleException was unhandled
    Message="ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of arguments in call to 'ADD_JOB_HISTORY'\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n"
    Source="System.Data.OracleClient"
    ErrorCode=-2146232008
    Code=6550
    StackTrace:
    at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
    This is calling ADD_JOB_HISTORY in the XE/HR database. How do I figure out what it is unhappy with? I have tried every variation I can think of for this. Latest is:
                             cmd.CommandType = CommandType.StoredProcedure;
                             cmd.CommandText = "ADD_JOB_HISTORY";
                             OracleParameter param = new OracleParameter("employee_id", OracleType.Number);
                             param.Value = 123;
                             cmd.Parameters.Add(param);
                             param = new OracleParameter("start_date", OracleType.DateTime);
                             param.Value = DateTime.Now.AddMonths(-1).Date;
                             cmd.Parameters.Add(param);
                             param = new OracleParameter("end_date", OracleType.DateTime);
                             param.Value = DateTime.Now.Date;
                             cmd.Parameters.Add(param);
                             param = new OracleParameter("job_id", OracleType.NVarChar);
                             param.Value = "SA_MAN";
                             cmd.Parameters.Add(param);
                             param = new OracleParameter("department_id", OracleType.Number);
                             param.Value = 10;
                             cmd.Parameters.Add(param);
    thanks - dave

    Dave,
    You can pass an entire select statement as single parameter, such as a varchar2. Then, you just have PL/SQL execute the SQL statement for you.
    Here's a code sample using ODP.NET for the same stored procedure that will work for the call to ADD_JOB_HISTORY. It appears you are using MS OracleClient in your code.
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Data;
    using Oracle.DataAccess.Client;
    namespace ConsoleApplication1
    class Program
    static void Main(string[] args)
    try
    OracleConnection con = new OracleConnection();
    con.ConnectionString = "User ID=hr;Password=hr;Data Source=xe;";
    con.Open();
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = con;
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = "ADD_JOB_HISTORY";
    OracleParameter param = new OracleParameter("employee_id", OracleDbType.Int16);
    param.Value = 123;
    cmd.Parameters.Add(param);
    param = new OracleParameter("start_date", OracleDbType.Date);
    param.Value = DateTime.Now.AddMonths(-1).Date;
    cmd.Parameters.Add(param);
    param = new OracleParameter("end_date", OracleDbType.Date);
    param.Value = DateTime.Now.Date;
    cmd.Parameters.Add(param);
    param = new OracleParameter("job_id", OracleDbType.NVarchar2);
    param.Value = "SA_MAN";
    cmd.Parameters.Add(param);
    param = new OracleParameter("department_id", OracleDbType.Int16);
    param.Value = 10;
    cmd.Parameters.Add(param);
    cmd.ExecuteNonQuery();
    Console.ReadLine();
    catch (Exception ex)
    Console.WriteLine(ex.Message.ToString());
    Console.WriteLine(ex.StackTrace.ToString());
    }

  • Calling Oracle stored procedure from java

    The following query calls a stored procedure TRANSLATE_ZONEPATH_ID defined in a package MT by the user MTDBA. currentZone is a member variable of the class, and currently has value 1
    This query works just fine when I run it from SQLPlus* connected as MTDBA.
    But from java, the following piece throws exception saying "invalid column name"
    String query = "SELECT MTDBA.MT.TRANSLATE_ZONEPATH_ID('"+currentZone+"') "
    + "FROM DUAL ";
    try
    Statement stmt = conn.createStatement();
    ResultSet rst = stmt.executeQuery(query);
    if (rst.next())
    fullName = rst.getString(1);
    stmt.close();
    Anyone got any clue ?

    I always use CallableStatement to execute a stored procedure or function in a database (Oracle).
    try this:
    <code>
    CallableStatement cs = dbConnection.prepareCall("{ ? =
    MTDBA.MT.TRANSLATE_ZONEPATH_ID(?)}");
    cs.setString(1, currentZone);
    cs.registerOutParameter(1, Types.VARCHAR);
    cs.executeUpdate();
    fullname = cs.getString(1);
    cs.close();
    </code>
    There is also a jdbc forum, where your should post this kind of problem :-)
    Hope this help's
    ThK

  • Calling Oracle stored procedure from xMII Query Templates.

    Hi All,
    We have a requirement to call a Oracle stored procedure from xMII, the SP expects some inputs and then it returns multiple rows.
    I tried different approches with no results, I remember some posts on the same topic but I could not get in search results.
    Looking for some help in this regards
    Rupesh.

    Hi Rupesh Bajaj,
    In oracle stored procedure we have to use Packages..if you used packages the u have to assign to some variable.
    To calling Stored procedure  in Query Template is CALL Testing('[Param.1]','[Param.2]',,:X)
    In above line Testing is Stored procedure name and Param.1 is parameters and X is Package.
    Thanks
    Ravilla Ramesh

Maybe you are looking for

  • Problems after iOS 4.2 upgrade.

    Hello everyone, hope you are all well. Could use some help to restore my 2G Touch after upgrading it to 4.2 the other day. During the upgrade, all it`s music and all the app`s were lost, but after re-synching only the music and the original factory a

  • I lost most of iLife apps is there a way i can get them back?

    Hello. I lost almost all my iLife apps when someone from family accidently deleted them. I have lost the CD you got with the mac a long time ago. Is there a way i can recover all those apps? I need iPhoto, iWeb, Garageband, iMovie.

  • Need help please: cover flow sort order logic

    hi community, is there a official document / specification from apple where the sort order and the settings of the corresponding tags (album, album artist, compilation on/off) of the cover flow is described? AA) i use diffent ipods. earlier versions

  • Help: My PowerBookG4 has gotten very slow

    All of a sudden my PowerBook G4 has become very slow. I get lots of beachballs while it is thinking what to do. It takes 5 minutes to restart and sometimes 5-10 seconds just to open a folder (with a beachball while I wait). All apps are running slow.

  • Garbled Text with Tiger Install

    need some help with a G4 Dual 1 ghz M8493 Quicksilver that I bought that has some issues with the operating system. I erased the 80G drive and free space and Installed Tiger by starting up on the install disk all the text was jumbled up and missing.