Entity framework-calling stored Proc to return one param returns ORA-6550

Hi There,
I am new to the VS2010/MVC3 game with ODP.net, so no abuse please .......
I have successfully inserted a record into a table via the controller/entity framework, but only by currently hard coding the id. The next logical step is to attempt to obtain the id from the Oracle DB via a stored procedure. Here is the body of the PL/SQL procedure on the Oracle side:-
create or replace package body dotnetcommon as
PROCEDURE getnextpoid ( p_to_id OUT NUMBER ) IS
BEGIN
     SELECT pord_seq.nextval INTO p_to_id FROM dual;
END getnextpoid;
end dotnetcommon;
show error
I have then added this procedure to my Entity Framework Model within VS2010 , and from within the Model Browser, I now have a stored procedure of "DOTNETCOMMON_GETNEXTPOID" under my Model.Store. This has an out type parameter named p_to_id, which is a type of number.
I then added a function import, so I have a function by the name of "GETNEXTPOID" under the Function Imports folder, with a collection property of 'None'.
This function has a parameter P_TO_ID with a type of "Decimal".
From within my controller, I have the following code:-
[HttpPost]
public string Create(PURCHASEORDER po)
TasEntities tmprep = new TasEntities();
ObjectParameter poid = new ObjectParameter("poId", typeof(Int16));
var result = tmprep.GETNEXTPOID(poid);
return "Next PO Id is " + result;
Thus, on pressing the Save from my view, i am hoping to return the next logical sequence number into the poid objectparameter. However, I am presented with the following error:-
Inner Exception of:-
{"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETNEXTPOID'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"}
It falls over , taking me to the Model.Designer.cs at :-
public int GETNEXTPOID(ObjectParameter p_TO_ID)
return base.ExecuteFunction("GETNEXTPOID", p_TO_ID);
I am assuming it is to do with the decimal/int/number conversion, but I do not have the nouse to fix it ? Does anybody know what is wrong with what I have attempted to do above ?
Please please get back to me if you need any more information, I am wanting to move on but cannot.
I have seen posts regarding setting the sequence in a before insert trigger on the table, but this is not ideal. Can the above not work instead ?
Many thanks in advance for any help you can provide.
Graeme
Edited by: user4487499 on 05-Apr-2011 08:18

I have now raised this in the odp.net forum, as on looking at other posts it seems to be the best place for it.
Cheers,
Graeme
Edited by: user4487499 on 05-Apr-2011 08:18
Edited by: user4487499 on 05-Apr-2011 13:00

Similar Messages

  • SQL Exception: Invalid column index while calling stored proc from CO.java

    Hello all,
    I am getting a "SQL Exception: Invalid column index" error while calling stored proc from CO.java
    # I am trying to call this proc from controller instead of AM
    # PL/SQL Proc has 4 IN params and 1 Out param.
    Code I am using is pasted below
    ==============================================
              OAApplicationModule am = (OAApplicationModule)oapagecontext.getApplicationModule(oawebbean);
    OADBTransaction txn = (OADBTransaction)am.getOADBTransaction();
    OracleCallableStatement cs = null;
    cs = (OracleCallableStatement)txn.createCallableStatement("begin MY_PACKAGE.SEND_EMAIL_ON_PASSWORD_CHANGE(:1, :2, :3, :4, :5); end;", 1);
         try
    cs.registerOutParameter(5, Types.VARCHAR, 0, 2000);
                        cs.setString(1, "[email protected]");
                             cs.setString(2, s10);
    //Debug
    System.out.println(s10);
                             cs.setString (3, "p_subject " );
                             cs.setString (4, "clob_html_message - WPTEST" );
                   outParamValue = cs.getString(1);
    cs.executeQuery();
    txn.commit();
    catch(SQLException ex)
    throw new OAException("SQL Exception: "+ex.getMessage());
    =========================================
    Can you help please.
    Thanks,
    Vinod

    You may refer below URL
    http://oracleanil.blogspot.com/2009/04/itemqueryvoxml.html
    Thanks
    AJ

  • Calling stored proc from java to return ref cursor

    Hi All,
    We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
    Following is the PL/SQL proc ?
    procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
    begin
    open v1 for
    SELECT lrn_exp_id, crs_name FROM emp_crs
    WHERE personid = persid;
    end;
    Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
    The java code is ?
    Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
    stmt.registerOutParameter(1,OracleTypes.CURSOR);
    stmt.setString(2,emplId);
    stmt.execute();
    OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
    ResultSet rs = tstmt.getCursor (1);
    When I run the program, I get the following error (at stmt.execute()):
    [Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
    Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?

    These may help
    http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial

  • Portable way to call Stored Procs. which return a ResultSet (MySQL/Oracle)?

    Hello!
    I have developed a Java application which calls stored procedures, some of which return a ResultSet (always one).
    I need to support more DBMS vendors, so I used the standard JDBC syntax to call the stored procedures ({call storedProcedure(?,?)}).
    I developed the code using MySQL, but succeded to call SQL Server 2000 stored procedures changing only the driver (that's the purpose of JDBC, right?).
    Now I need to support the Oracle DBMS, but I can't find a way to create a stored procedure which returns a result set and allows me not to change the already stable Java code.
    How could I achieve this result? Should I use some other Oracle object, say a function?
    By the way, I searched the Internet, but only found solutions which would've made me change code. This is definitely not portable
    Thank you very much for your help!
    PS: Some of the stored procedures return both a ResultSet AND OUT parameters.

    Hello and thanks for your reply, jwenting.
    However, keeping useless "philosophy" out of this thread, please just let me clarify that I obviously didn't want portability of stored procedures, I just wanted a standard JDBC to interface with them. I haven't had problems in the past with stored procedures and other DBMSs, I'm having them just now with the Oracle JDBC driver. Since JDBC is meant to be portable, I hoped there was a portable way of calling Oracle stored procedures (or whatever else in Oracle takes inputs and returns output and a ResultSet...). Unfortunately, there doesn't seem to be any, unless I use a commercial driver from DataDirect. I find this a heavy limitation of the Oracle JDBC driver, but, alas, here it is... I'll have to refactor my stable code...
    Thanks again...

  • Calling Stored Proc from JDBC

    Hi All,
    I have a simple stored proc in SQL server 2000
    CREATE PROCEDURE dbo.sp_myProc
    AS
    SELECT CategoryID,CategoryName from Categories
    GO
    My java code is
    CallableStatement cs = connection.prepareCall("{? = call sp_myProc}");
    cs.registerOutParameter(1, Types.VARCHAR);
    boolean result = cs.execute();
    System.out.println("Result : "+result);
    ResultSet rs = (ResultSet)cs.getResultSet();
    while(rs.next())
    System.out.println(rs.getString("CategoryID"));
    When I execute this, the stored procedure gets executed succesfully i.e, the Result is true.
    But the resultset object : rs is Null. It returns a null pointer exception at rs.next();
    The table has values & this returns proper values in SQL analyzer.
    I use Microsoft JDBC drivers for SQL server.
    Is there anything I am doing wrong, all examples i saw refered to the same thing. I am struck with this any help would be appreciated.
    Thanks in advance,
    Sudhindra

    Sorry - small mistake here.
    The number of ? marks in the () brackets = the number of parameters in the procedure.
    Thus with your procedure nothing gets returned.
    With an Oracle Db you will declare the proc as follows:
    PROCEDURE abcd (par1 IN OUT VARCHAR2, par2 IN OUT VARCHAR2)
    IS
    BEGIN
    SELECT abc, def INTO par1, par2 FROM xyz;
    END;
    Thus you will register two in String parameters AND two out String parameters.
    If you require more than one record to be returned the you need to have a look at some collection type to be returned other than VARCHAR2.
    Andre

  • Calling stored proc from java using ref cursor

    Hi All,
    We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
    Following is the PL/SQL proc �
    procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
    begin
    open v1 for
    SELECT lrn_exp_id, crs_name FROM emp_crs
    WHERE personid = persid;
    end;
    Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
    The java code is �
    Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
    stmt.registerOutParameter(1,OracleTypes.CURSOR);
    stmt.setString(2,emplId);
    stmt.execute();
    OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
    ResultSet rs = tstmt.getCursor (1);
    When I run the program, I get the following error (at stmt.execute()):
    [Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
    Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?

    These may help
    http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial

  • Calling stored proc through JDBC

    Hello all,
    What I am doing is calling a stored proceedure in this manner...
    CallableStatement stmt = dbB.getConn().prepareCall ("call LDPKG.LDGetData(?, ?)");  //dbB is a conn Class I made, it works fine and getConn obviously jsut returns teh Connection object... Those work fine disreguard them.
    stmt.registerOutParameter(1, <IDONTKNOW>);  //I dont know the return type
    stmt.registerOutParameter(2, <IDONTKNOW>);  //I dont know the return type
    stmt.execute();I am unsure of what to put for the return type... The DB has these TYPES created as teh OUT for the stored Proc ...
    TYPE t_returnId is table of LDDATA.UserId%TYPE index by BINARY_INTEGER
    TYPE t_returnName is table of LDDATA.UserName%TYPE index by BINARY_INTEGER
    I dont know how to translate that return type to Java... Any ideas???
    Thanks!

    If you want the whole thing it is like this... I just didnt see the point in being redundant with the output types. Now that Date is an issue I brought it up. didnt think i needed to before.. sorry.
    OracleCallableStatement stmt = (OracleCallableStatement)dbB.getConn().prepareCall ("begin LDPKG.LDGetData(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); end;");
    stmt.registerIndexTableOutParameter(1,500, OracleTypes.NUMBER, 0);
    stmt.registerIndexTableOutParameter(2,500, OracleTypes.DATE, 0);
    stmt.registerIndexTableOutParameter(3,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(4,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(5,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(6,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(7,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(8,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(9,500, OracleTypes.NUMBER, 0);
    stmt.registerIndexTableOutParameter(10,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(11,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(12,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(13,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(14,500, OracleTypes.VARCHAR, 0);
    stmt.execute();I'm still looking through Google but not finding much about this :(.

  • Call stored proc from inside sp

    I am trying to call a stored proc from inside a stored proc and the stored proc needs to return a ref_cursor. I am trying to loop over the returned ref_cursor, but my problem is that when I compile the sp it says the ref_cursor is not a procedure or is undefined. Can anyone please tell me why I am getting this error? Refer to the code below!
    create or replace
    PROCEDURE TCS_GetPartReferenceData
    contracts IN VARCHAR2
    , showInWork IN INTEGER
    , userClock IN VARCHAR2
    , intMaxResults IN INTEGER
    , ret_cursor OUT SYS_REFCURSOR
    ) AS
    p_cursor SYS_REFCURSOR;
    BEGIN
    TCS_GETDRNSFORCONTRACTS(contracts
    , showinwork
    , userClock
    , intmaxresults
    , p_cursor);
    for r in p_cursor loop
    dbms_output.put_line(r.puid);
    end loop;
    END TCS_GetPartReferenceData;

    Probably you want sth. like
    CREATE OR REPLACE PROCEDURE tcs_getpartreferencedata (contracts       IN     VARCHAR2,
                                        showinwork      IN     INTEGER,
                                        userclock       IN     VARCHAR2,
                                        intmaxresults   IN     INTEGER,
                                        ret_cursor         OUT sys_refcursor)
    AS
    BEGIN
       tcs_getdrnsforcontracts (contracts,
                                showinwork,
                                userclock,
                                intmaxresults,
                                ret_cursor);
    END tcs_getpartreferencedata;
    var cur refcursor
    exec tcs_getpartreferencedata(contracts_value,showinwork_value,userclock_value,intmaxresults_value, :cur)
    print curfill in appropriate values for the parameters _value ....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Call stored proc

    Hello!
    We use TT as CacheConnect to Oracle Database 10g. Can we call Oracle Database 10g stored proc from our C++ application? Than passthrough level we must to use if we can perform this call?
    Thank you!

    You can call Stored procedures using PassThrough=3 provided that the procedure does not return any values.
    Note that the procedure will execute in Oracle against Oracle data not against TimesTen data.
    Chris

  • Calling stored proc via services

    I would be grateful if you could help me in resolving a technical issue in CMS(stellent).
    We have a requirement that we need to call a stored procedure through services .The stored proc takes an input argument and returns a result set and has a defination that starts like
    create or replace
    PACKAGE BODY GETPROJECTPCKG IS
    PROCEDURE PROC_RPU (rpu_list_count IN number, temp_project_cursor OUT project_ref_cursor) IS.
    I've defined a service call like
    <tr>
         <td>GET_RPU_INFO</td>
         <td>DocService
              33
              RECENTPROJECTUPDATE
              null
              null<br>
              null</td>
         <td>5:QgetRpuNames:temp_project_cursor::null</td>
    </tr>
    And below is how I've called the procedure
    <tr>
         <td>QgetRpuNames</td>
         <td>{call GETPROJECTPCKG.PROC_RPU(?)}</td>
         <td>rpu_list_count int</td>
    </tr>
    i tried calling procedure as below also ..
    <tr>
         <td>QgetRpuNames</td>
         <td>{call GETPROJECTPCKG.PROC_RPU(?,?)}</td>
         <td>rpu_list_count int
         temp_project_cursor out:resultset</td>
    </tr>
    As per my understanding the temp_project_cursor which is the resultset that would be returned from procedure should be available on the template specified.
    But while executing the service I am getting an error :
    Unable to create result set for query 'QgetRpuNames({call GETPROJECTPCKG.PROC_RPU(10)})'. ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PROC_RPU'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored)
    Can you please assist.

    Hey
    if this is still an issue please refert "Call Stored Procedure from Oracle Fusion ECM (Stellent) " at http://www.corecontentonly.com/index.php/downloads/. Jason has shared a component that you can make use of.
    cheers,
    sapan

  • Call stored proc problem (SQL exception)

    Hello
    I have a stored procedure with one param
    as follows:
    PROCEDURE test1 (xnrid IN VARCHAR2)
    This stored procedure is created in package known as "smart".
    I tried to call my stored proc via toplink as follows:
              UnitOfWork uow= dbSession.acquireUnitOfWork();
              StoredProcedureCall storedProcedureCall = new StoredProcedureCall();
              storedProcedureCall.setProcedureName("smart.test1");
              storedProcedureCall.addNamedArgument("xnrid");
              DataReadQuery query = new DataReadQuery();
              query.setCall(storedProcedureCall);
              Vector parameters = new Vector();
              //storedProcedureCall.setUsesBinding(true);
              /** For all input params **/
              query.addArgument("xnrid");
              parameters.add("ffff");
              /** execute query **/
              Object result = dbSession.executeQuery(query, parameters);
    And I have good oracle exception such as
    Internal Exception: java.sql.SQLException: ORA-00900: invalid SQL statement
    Error Code: 900
    Call:BEGIN smart.test1(xnrid=>'ffff'); END;
    Any help is appreciated
    gurcan

    Hi Sharon
    1. You said this code is written in the stored procedure.
    2. The scope of the temporary table is valid till its executer's session is valid.
    3. So if you execute the stored procedure and then try to find these temporary tables then you wont find them as the stored procedure has already finished its execution. And as soon as the execution of the stored procedure is over these temporary tables are automatically deleted.
    4. If you try to execute the code individually then it will show up untill you are logged on. And as your session is valid (Untill you are logged on), SQL Server will show up the tables.
    5. As a proof-of-concept:
    - Logon to SQL Server.
    - Create a temporary table.
    - Log off from SQL Server.
    - Log on again and try to find the temp table you created. It would not be there as it was valid only for your earlier session.
    Let me know if you have any further queries.
    Regards
    Nikhil

  • Entity Framework : A short way to copy one object with it's child to a new object ?

    Hello !
    I'm using entity framework 6.
    Sometimes I need to copy an existing object with all its childs to a new object and to save to database.
    I'm using a standart way by creating a new object , copy one by one it's properties from existing object ( except the ID ) , after I create new object for every child and copy one by one each properties except the ID and Parent id......
    But of course this is a hard way to do especially when the object have a lot's of properties.
    I want to know is there any short way  ( built in) to do this ?
    Thank you !

    Actually , I'm using this extension :
    Imports System.ComponentModel
    Imports System.Collections
    Imports System.Data.Entity.Core.Objects.DataClasses
    Imports System.Runtime.Serialization
    Imports System.IO
    Imports System.Reflection
    Module Extensions
    <System.Runtime.CompilerServices.Extension> _
    Public Function Clone(Of T As EntityObject)(source As T) As T
    Dim ser = New DataContractSerializer(GetType(T))
    Using stream = New MemoryStream()
    ser.WriteObject(stream, source)
    stream.Seek(0, SeekOrigin.Begin)
    Return CType(ser.ReadObject(stream), T)
    End Using
    End Function
    <System.Runtime.CompilerServices.Extension> _
    Public Function ClearEntityReference(source As EntityObject, bCheckHierarchy As Boolean) As EntityObject
    Return source.ClearEntityObject(bCheckHierarchy)
    End Function
    <System.Runtime.CompilerServices.Extension> _
    Private Function ClearEntityObject(Of T As Class)(source As T, bCheckHierarchy As Boolean) As T
    If source Is Nothing Then
    Throw New Exception("Null Object cannot be cloned")
    End If
    Dim tObj As Type = source.[GetType]()
    If tObj.GetProperty("EntityKey") IsNot Nothing Then
    tObj.GetProperty("EntityKey").SetValue(source, Nothing, Nothing)
    End If
    If Not bCheckHierarchy Then
    Return CType(source, T)
    End If
    Dim PropertyList As List(Of PropertyInfo) = (From a In source.[GetType]().GetProperties() Where a.PropertyType.Name.Equals("ENTITYCOLLECTION`1", StringComparison.OrdinalIgnoreCase) Select a).ToList()
    For Each prop As PropertyInfo In PropertyList
    Dim keys As IEnumerable = CType(tObj.GetProperty(prop.Name).GetValue(source, Nothing), IEnumerable)
    For Each key As Object In keys
    Dim childProp = (From a In key.[GetType]().GetProperties() Where a.PropertyType.Name.Equals("EntityReference`1", StringComparison.OrdinalIgnoreCase) Select a).SingleOrDefault()
    childProp.GetValue(key, Nothing).ClearEntityObject(False)
    key.ClearEntityObject(True)
    Next
    Next
    Return CType(source, T)
    End Function
    End Module
    But the problem is that when I try to use like this :
    Dim litm, newitm as MyObject
    For Each litm In itemlist
    newitm = litm.Clone()
    newitm.ClearEntityReference(True)
    context.MyObjects.Add(newitm)
    Next
    context.SaveChanges()
    I get an error :
    Public member 'Clone' on type 'MyObject' not found.

  • Entity Framework - Execute Stored Procedures

    I want to execute stored procedure using entity framework.
    I am using entity framework 6.
    The stored procedure has SELECT and RETURN statement.
    How can I read the output from SELECT and RETURN statements using
    dbContext.Database.ExecuteSqlCommand or dbContext.Database.SqlQuery statement ?

    Hello Sumit Kadam,
    >> The stored procedure has SELECT and RETURN statement.
    For the select statement, Entity Framework would support natively:
    http://www.entityframeworktutorial.net/stored-procedure-in-entity-framework.aspx
    For the return statement, we could use the dbContext.Database.SqlQuery statement as below to fetch the value:
    var returnCode = new SqlParameter();
    returnCode.ParameterName = "@ReturnCode";
    returnCode.SqlDbType = SqlDbType.Int;
    returnCode.Direction = ParameterDirection.Output;
    // assign the return code to the new output parameter and pass it to the sp
    var data = db.Database.SqlQuery<Order>("exec @ReturnCode = ProGetOrder", returnCode);
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Calling stored proc (with 2 IN and 3 OUT) - from SQL Plus

    This is the signature of my stored proc:
    CREATE OR REPLACE PROCEDURE myschema.myproc
       p_usr_name     IN  VARCHAR2,    
       p_send_tmstmp  IN  DATE,    
       p_ret_value    OUT NUMBER,
       p_err_code     OUT VARCHAR2
    )If I need to call it from sql plus, how do I need to pass the arg?
    This is what I am doing
    execute myschema.myproc('abc123','02-MAY-2008');
    What is wrong here? If someone could help. Thx!

    Try something like this
    var usr_name    varchar2(30)  
    var send_tmstmp varchar2(11)  
    var ret_value   number
    var err_code    varchar2(10)
    begin
    :usr_name    := 'abc123';
    :usr_name := '02-MAY-2008';
    myschema.myproc ( p_usr_name           => :usr_name,
                      p_send_tmstmp        => TO_DATE( :usr_name, 'DD-MON-YYYY' ),
                      p_ret_value          => :ret_value,
                      p_err_code           => :err_code);
    end;
    print ret_value;
    print err_code;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Use 'default' keyword in call string while calling stored proc?

    I am calling following sql server stored procedure from java code using my jdbc driver for sql server: CREATE PROCEDURE test_findTbInfo (
    @paramIn_Str varchar(10),
    @paramOut_Int int OUT,
    @paramIn_Int int = 20
    AS
    begin
    set @paramOut_Int = @paramIn_Int * 100
    end
    If I make a call like this:
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , , ? ) }");
    cs.setString(1, "test_tab");
    cs.setInt(2, 4);
    cs.execute();
    It works without any error. But this is not a right behavior. !! The second parameter as you see is passed like an optional parameter. But in stored proc it is NOT an optional param and so if the value not passed it should fail...
    Now if I change the code to
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , default, ? ) }");
    it works correctly. Gives error that "Procedure 'test_findTbInfo' expects parameter '@paramOut_Int', which was not supplied." which is correct.
    So is it a normal practice to use 'default' keyword while calling sql server stored procedures having optional parameters in jdbc ????
    Anyone knows ??? As far as I know "call test_findTbInfo(? , , ? )" works fine except in some cases and also it forces users to put all optional parameters at the end of parameter list in stored proc.
    Please let me know whether I should go with 'default' throuout for sql server stored proc while calling using my jdbc driver.
    Amit

    {?= call <procedure-name>[<arg1>,<arg2>, ...]}The question mark in the above is the result parameter
    that must be registered.
    That is not the same as an OUT argument.Yes that is true. The result value and OUT parameters are different but they both MUST be registered as per jdbc API
    "The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here."
    Anyway, my original question still stays as it was. If there are some optional IN parameters in stored procedure
    e.g.
    PROCEDURE test_findTbInfo (
    @paramIn_Int int = 20,
    @paramOut_Int int OUT
    how do you call this?
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo( , ? ) }");
    cs.registerOutParameter(1, Types.INTEGER);
    cs.execute();
    or
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(default, ? ) }");
    Also note that I am intending to use ONLY sql server driver for this.
    The first as well second seem to work. Except that second way is seems reliable. I just wanted a second opinion on that...
    Amit

Maybe you are looking for

  • How can you create an online account for a family plan of 3?

    Hey there, I recently switched from T-mobile to Verizon and got a family plan(10 GB More Everything Plan with Verizon Edge) for my parents and myself at the store. Unlike T-mobile where you can see activities of all 3 phones, the Verizon online accou

  • Live TV buffering in Media Player filling up SSD?

    Hi all:    I have a HTPC with a SiliconDust HDHomeRun DUAL 2-Tuner ATSC DLNA/UPnP Compatible Streaming Media Player, HDHR4-2US.  This is a network tuner that can stream live tv over the network to multiple computers.  It is supposed to work with Wind

  • WRT54G3G-ST with Pantech px-500

    Hello: I am new to these forums so be easy on me. I was wondering if the WRT54G3G-ST is compatible with the Pantech PX-500 Sprint card. I have heard mixed reviews. Are there any confirmed cases of them working together? Is there a firmware issue here

  • Standard output automatically line wraps at 40 characters, How to stop that

    Hello, After frustrated searching I will ask this. I am currently using the terminal to run my fortran code using gfortran and intel's ifort (10.1.015) writing relevant data to the standard out by write(,) or write(*,100) 100 format(i4,1x,4(f8.3,1x)

  • Fiori Leave Approval App -  Scenario Defenition Error

    When I execute the Leave approval service in browser I get the below error, maintained the scenario definition settings as per the installation guide, my service pack level is Fiori SP03, so all the relevant, mandatory notes are applied. Could you su