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

Similar Messages

  • Error while Compiling Stored proc

    I am having problem while compiling stored proc.It gives the following error
    "Error while trying to retrieve text for error - ORA-03113"
    I have my SQL file in which i am adding the input parameters (aroung 100 parameters). Till 53 parameters i added it created the procedure now after that i am adding the parameteres one by one but its giving the same error.
    null

    Hi Minish,
    Whatever you wrote in crontab is fine. But we can call a stored procedure from Shell Script provide the shell script must have a sql file which contain the procedure to be excuted.
    Follow the things...
    Assume that,
    1. you have file called load.sql
    it contains...
    load_data;
    2. your shell script must have this code
    . /home/nimish/.profile
    sqlplus scott/tiger@orcl_bk load.sql
    *** make sure that sql file should have executable permissions
    Good Luck
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Nimish Buch:
    I want to run a stored procedure as an end of day process. I wrote a small unix shell script to run the procedure from a sql session, similar to following.
    . /home/nimish/.profile
    sqlplus scott/tiger@orcl_bk < execute load_data;
    If I run this script manually, it runs fine. I get the following errors when I attempt to run it as a cron job.
    Message file sp1.msb not found
    I have checked sp1us.msb does exist in ORACLE_HOME/sqlplus/mesg directory. I even tried giving it's path in PATH variable.
    Any help with this will be appreciated.
    Thanks a lot.
    Nimish<HR></BLOCKQUOTE>
    null

  • Call lag while calling and receiving calls in blackberry leap

    I am facing 3-4seconds call lag while receiving and calling and this is getting very irritating. Is this a bug or what, if yes then what is the resolution for this. Are we getting 10.3.2 for BlackBerry leap.

    Somewhat duplicated, at least as far as the update availability:http://supportforums.blackberry.com/t5/BlackBerry-Leap/When-we-will-get-10-3-2-update-in-india-for-blackberry-leap/m-p/3122959#nobanner As for your specific issue, if you don't reveal your OS level, it's impossible for anyone to determine if perhaps it is the OS version that is the issue for you...this issue is well documented, but seems to be specific version dependent. Refer:Article ID: KB23393 How to find the model number and OS version on a BlackBerry smartphoneIf I had to guess (and, without information from you, that's all I can do), I'd guess that indeed you are running an OS level that presents this issue, and should update to newer versions to see if it resolves your issue. Do note that once you go up to 10.3.2, you cannot go back to 10.3.1 or prior. Good luck!

  • Call EJB From Oracle Stored proc or Database loaded Java?

    Are there any examples of calling an EJB, residing in the OC4J on a machine separate from the DB server,
    from an Oracle PL/SQL stored proc.
    The Stored proc can call java loaded into the DB. That java makes the intial bean context. Or another way if suggested.
    The reason is that I need to use some drivers that I have so far been unable to load directly into the DB using
    loadjava util. I plan on using the driver in the EJB, located on a different machine. But I'd like so know if its possible to
    make the IntialContext call to the EJB container from PL/SQL. Are the OC4J drivers loadable to be
    able to be called from a database loaded java class? ( I might be a little off on my terminology)
    Bob
    [email protected]

    Hi Bob,
    Your question has been previously asked on this forum many times already.
    You can probably find the relevant postings by doing a search of the
    forum archives.
    To summarize those posts, as I understand it, the latest version of OC4J
    (version 9.0.3) contains a "oc4jclient.jar" file (I think that's the name
    of the file), that can be loaded into the Oracle database (using the
    "loadjava" utility), and which allows a java stored procedure to invoke
    methods on an EJB residing in OC4J.
    Please note that I have not tried any of the above -- I am only summarizing
    for you what has already been posted. And like I said before, a search
    of the forum archives will probably give you more details.
    Good Luck,
    Avi.

  • C:import tag - Query string while calling servlet from JSP

    Hi,
    From my JSP I am calling a servlet to write back to the response stream of the JSP. From the JSP i am trying to pass some values into the query string as follows
         <%
         String strGetParameters = "/servlet/MyServlet?path=" + strPath;
          %>
         <pre><c:import url="<%=strGetParameters%>" /></pre>In the servlet I try to get the path from the query string by using
    request.getParameter("path")But in the servlet the query string doesnt have the "path" parameter that I added in the strGetParameters string (in the JSP).
    Am i missing something? Do i have to use something else or do something else?
    Any help is appreciated.

    I've taken some time to do a simple test and it just works.
    Here is the test code, it was tested in Java EE 5 + JSTL 1.2 + Tomcat 6.
    JSP<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <html>
        <head>
            <title>Test</title>
        </head>
        <body>
            <pre>
                <c:import url="myServlet?param1=foo&param2=bar">
                    <c:param name="param3" value="meep" />
                    <c:param name="param4" value="waah" />
                </c:import>
            </pre>
        </body>
    </html>MyServlet (mapped on "/myServlet")package mypackage;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class MyServlet extends HttpServlet {
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
            String param1 = request.getParameter("param1");
            String param2 = request.getParameter("param2");
            String param3 = request.getParameter("param3");
            String param4 = request.getParameter("param4");
            String output = param1 + ", " + param2 + ", " + param3 + ", " + param4;
            response.getOutputStream().write(output.getBytes());
    }All parameters gets printed.

  • How can i merge calls via I Phone 3 GS as my phone is not supporting to the call merge while call merging is available on my phone via my n/w provider ?

    Any one help me out in this?

    And who is your carrier?
    Supported carriers in India are Aircel and airtel. If you're using a different carrier, you will have to work it out with them.

  • Return String from Oracle stored proc using Excel 2003 VBA

    Hi to everyone,
    I've got a problem that remains unsolved for many days. I am trying to return a value of an oracle stored procedure using Excel VBA. It might seem trivial, however it's not for someone, who has never done it before...
    OS: Win XP SP3
    Excel 2003
    Ora Client: 11g
    By trying different things I have noticed, that I could have troubles with the ODBC-connection. Maybe I am not using the right one. To store data returned from select statements I have an ODBC-Connection (Driver: Oracle in XE), which works perfectly, e.g.:
    Sub Extract_Data()
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim db_name, UserName, Password As String
    cn.Open db_name, USerName, Password
    sql_statement = "SELECT some_text FROM some_table"
    Set rs = cn.Execute(sql_statement)
    rs.MoveFirst 'jump to the first entry in the data list
    Row = 2
    While Not rs.EOF
    'save the data to a worksheet
    ip.Cells(Row, 2) = rs(0).Value
    Row = Row + 1
    rs.MoveNext
    Wend
    End Sub
    Now I need to execute a stored procedure to return a semi-colon delimited string.
    I have tried the following:
    Public Sub obj_class()
    Dim cn As New ADODB.Connection
    Dim strSQL, cn As String
    Dim adoCMD As ADODB.Command
    Dim adoRS As ADODB.Recordset
    Set wb = Excel.ActiveWorkbook
    Set ih = wb.Sheets("InfoSheet")
    cn.Open db_name, UserName, Password
    Set adoCMD = New ADODB.Command
    With adoCMD
    .ActiveConnection = cn
    .CommandText = "S#mdb$stg_da_extr_util.get_all_classes_of_classif"
    .CommandType = adCmdStoredProc
    .Parameters.Refresh
    '------ and here comes the error saying:
    '------ could not find the object in the collection corresponding to the name or ordinal reference requested by the application
    .Parameters("i_caller").Value = "'STG_DATA_REQUEST'"
    .Parameters("i_obj_classif_id").Value = 120
    Set adoRS = .Execute()
    End With
    End Sub
    I did asked on the forum:
    http://www.access-programmers.co.uk/forums/showthread.php?p=1241667#post1241667
    but unfortunately without success.
    Could it be, that my ODBC-connection is wrong? When debugging the connection string, I find the Provider=MSDASQL5.1.
    I have moderate knowledge in VBA, but absolutely a newbie with Oracle DB. Is there any source of information that can help solving this issue? Looking forward to hearing from you, as I am almost giving up... ;(

    My VBA is super rusty. Does that error come after Parameters.Refresh, or after .Parameters("i_caller").Value = "'STG_DATA_REQUEST'"?
    If it's the second one, you'll need the definition of the stored procedure so you can see what parameters it's expecting. That'd mean you're getting something wrong with the names.

  • Error in PeopleTools 8.48 while calling CI based Web Services from BPEL

    Hi All,
    I am working with a CI based web serives and using the PeopleSoft generated wsdl file while calling from a BPEL process. When I am using the same component in PeopleTools 8.47, it's working fine. But the same is NOT working when I'm using PeopleTools 8.48 using the same BPEL server and program.
    Here is the error message :-
    exception on JaxRpc invoke: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: oracle_endpoint: oracle_endpoint.
    Please help if you know the answer.

    Hi,
    You need to download all the associated xml schemas from PeopleSoft portal and store them in the path where you are creating BPEL process, it's different from what we used to do in PeopleTools 8.47 ( there was only one wsdl file), whereas in PeopleTools 8.48 you need to copy all associated xml schemas.
    But I m not able to find out why the native JAVA error is thrown, do I need to provide some patches?

  • How do I use the event.target.name String with an external dispatchEvent?

    ...I hope the title question makes sense...
    On my stage I have an externally loaded SWF with a button. When clicked the button dispatches an event to the main stage.
    On the main stage a listener then loads an SWF into a loader called gallery.
    The gallery loader is also being shared by buttons on the main stage which use the event.target.name String to call in SWFs with corresponding names.
    I am using Tweens to fade-out and -in content to the gallery when a button is pressed.
    Loading the SWFs was working until I tried to create a universal button function for the dispatchEvent buttons...
    The problem I have is that I don't know how to define the String to tell the newSWFRequest where to find the SWF when triggered by the external buttons.
    (I may be doing this all wrong... but figured the best way to load an SWF on to the main stage from an external SWF was by using dispatchEvent??)
    My code triggers the Event and the gallery loader fades out, but then it cannot find the new SWF:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    Please can someone help me understand the way to make the String point in the right direction? (I think the only errors are in bold below)
    Code:
    var myTweenIn2:Tween;
    var myTweenOut2:Tween;
    var nextLoadS2:String;
    // Listen for external event dispatched from external btns
    addEventListener("contactStage", btnClickExtrnl);
    function btnClickExtrnl(e:Event):void {
    nextLoadS2 = ?????
    myTweenOut2=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOut2.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    // Btns Universal function
    function tweenOutCompleteF2(e:TweenEvent){
    myTweenOut2.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    myTweenOut2=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + nextLoadS2 + ".swf");
    myTweenIn2 = new Tween(gallery, "alpha", None.easeOut, gallery.alpha, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    Thank you.

    That works – thank you!
    I'm now using this code to fade in each of the SWFs:
    function contactStage(e:MouseEvent):void {
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
        myTweenIn = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But I cannot add the fade out function. I have amended the above code to create:
    var myTweenOutX:Tween;
    var myTweenInX:Tween;
    function contactStage(e:MouseEvent):void {
    myTweenOutX=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOutX.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    function tweenOutCompleteFX(e:TweenEvent){
    myTweenOutX.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    myTweenOutX=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
    myTweenInX = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But get this error:
    ReferenceError: Error #1069: Property name not found on fl.transitions.Tween and there is no default value.
    at ACOUSTIC_fla::MainTimeline/tweenOutCompleteFX()[ACOUSTIC_fla.MainTimeline::frame1:110]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.transitions::Tween/set time()
    at fl.transitions::Tween/nextFrame()
    at fl.transitions::Tween/onEnterFrame()
    Where am I going wrong?

  • 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

  • No speed advantage using stored procs

    I'm using Oracle 9i from .NET using ODBC and have done some speed tests using regular SQL and then a stored proc (which contains the same SQL). Both execute in an average speed (n = 10) of about 1.43 seconds but every once in a while the stored proc chokes slightly and spits out a 1.97. The SQL is fairly complex (two sub-queries and several joins). I thought putting my SQL into a stored proc was supposed to offer me a speed advantage?

    Putting a single SQL statement into a stored procedure probably isn't going to do much to improve or degrade performance initially. Oracle still has to parse the statement when it is first executed, for example, regardless of where the statement is coming from. Putting SQL into a stored procedure benefits performance when
    1) It forces you to use bind variables correctly
    2) It allows you to avoid passing data back to the middle tier and/or client app by encapsulating multiple steps of a process.
    3) It allows someone to come along and tune poorly performing SQL without having to search for SQL that is buried in the bowels of different applications.
    Justin

  • Error while calling a Db2 stored proc  using Dataservice

    Hi ,
    I am getting the following exception while calling a Db2 proc.The proc is not returning any refcursor.It has one Input param of type String.We are expecting the result in resultset. I am able to call the proc using JDBC function and iterate tru the resultset and print it.
    While doing import the source Metadata , I Added a "Editable Row Set" Type.
    Any clue ?
    ava.lang.RuntimeException: Incorrect definition, too many return resultset
         at com.bea.ld.wrappers.procedure.ProcedureAdapter$CallableWrapper.getNextReturnValue(ProcedureAdapter.java:634)
         at com.bea.ld.wrappers.procedure.ProcedureIterator.getNextToken(ProcedureIterator.java:249)
         at com.bea.ld.wrappers.procedure.ProcedureIterator.fetchNext(ProcedureIterator.java:125)
         at weblogic.xml.query.iterators.GenericIterator.hasNext(GenericIterator.java:134)
         at weblogic.xml.query.runtime.sequences.Subsequence.fetchNext(Subsequence.java:106)
         at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:113)
         at weblogic.xml.query.runtime.querycide.QueryAssassin.fetchNext(QueryAssassin.java:54)
         at weblogic.xml.query.iterators.GenericIterator.peekNext(GenericIterator.java:151)
         at weblogic.xml.query.runtime.qname.InsertNamespaces.fetchNext(InsertNamespaces.java:161)
         at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:113)
         at weblogic.xml.query.runtime.core.QueryIterator.fetchNext(QueryIterator.java:127)
         at weblogic.xml.query.iterators.GenericIterator.hasNext(GenericIterator.java:134)
         at weblogic.xml.query.xdbc.util.Serializer.serializeItems(Serializer.java:142)
         at com.bea.ld.server.QueryInvocation.getResult(QueryInvocation.java:461)
         at com.bea.ld.EJBRequestHandler.executeFunction(EJBRequestHandler.java:346)
         at com.bea.ld.ServerBean.executeFunction(ServerBean.java:108)
         at com.bea.ld.Server_ydm4ie_EOImpl.executeFunction(Server_ydm4ie_EOImpl.java:208)
         at com.bea.ld.Server_ydm4ie_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:491)
         at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:120)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:434)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:429)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

    Hi,
    I am trying to do something like this but with Oracle stored procedure which returns an associate array and a cursor and these are defined as INOUT. I am not finding a way how to do it with editable row set. Can you plese list the steps used to make things work.
    Thanks.

  • Error while calling RFC when using BSP Web Interface

    Hi,
    we have a problem with the Authorization when we use an Web Interface for BSP. We have assigned all roles to the user which were mentioned in the SAP standard documentation:
    R_AREA   
    R_METHOD 
    R_PACKAGE
    R_PARAM  
    R_PLEVEL 
    R_PM_NAME
    R_PROFILE
    R_STS_PT 
    R_STS_SUP
    R_WEBITF 
    S_RS_ADMWB
    S_RS_AUTH
    S_RS_COMP
    S_RS_COMP1
    S_RS_DAS 
    S_RS_ICUBE
    but we still get the error message: "Error while calling RFC".
    When using a user with SAP_ALL, it works.
    What can we do?
    Thx for your time.
    Joerg

    Actually that's surprising - because BSP (Business Server Pages) and RFC (Remote Function Call) are not related; they use totally different transport protocols (http vs. RFC). Even if an BSP application is calling a function module remotely (acting as RFC client) no authorizations for S_RFC are required - in the calling system (but in the called system, i.e. the RFC server).
    Since assigning SAP_ALL seems to "cure" the problem, it seems to be an authorization issue, indeed. In that case it makes sense to use the authorization trace (ST01 - notice: that's specific to one single ABAP application server; you might have to activate the trace on multiple instances) to find out which authorizations are checked / demanded.

  • Fault while calling a Web service using SOAP 1.2

    Hi ,
    I have created a simple PL/SQL web service using Jdeveloper from PL/SQL using SOAP 1.2.
    But while i call that from PL/SQL, i am getting a version mismatch.
    While the same service created from SOAP 1.1 is working fine.
    Can anyone Help???

    Yip - Acrobat or Reader Extensions are needed.
    Try right click on the PDF and open in Internet Explorer and try your submit (hopefully the domain is trusted)

  • Error while calling BAPI_PARTNEREMPLOYEE_CREATE BAPI using JCO

    Hi All,
    Our requirement is to create and update customer contact details from java application. For this purpose we are trying to call BAPI_PARTNEREMPLOYEE_CREATE BAPI for create contact and BAPI_PARTNEREMPLOYEE_EDIT for updating contact information. As these BAPIs are of online version, error is coming while calling these BAPIs.
    So is there any way to call these BAPIs through JCO or are there any alternative BAPIs available for same purpose?
    Thanks in advance,
    Arati.

    Hi,
    All the bapi or function module available in SAP to create contact person will internally do a call transaction to VAP1 and VAP2 tcodes in order to create or change contact person respectively.
    We had a similar problem when we were creating and updating customer contact person using inbound idoc. We then created a bdc recording for the same and then created two function module with name Z_CREATE_CONTACT and Z_CHANGE_CONTACT. In your case you can make this function modules as RFC enabled FM and call them using JCO I guess.
    KR Jaideep,

Maybe you are looking for

  • Controlling "Log apply" on Logical standby.

    Hi, We are going Live with logical standby ina day or two, and suddenly found what seems to be a potential problem in the near future. Despite issuing the command ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;Logs are not getting applied immed

  • From a complete database dump, I need to import 8 schemas

    I have a complete database dump made with datapump on oracle 10g on Linux. I need to import only 8 schemas. In my parfile I have to use the INCLUDE option? How can I tell oracle to import only these 4 schemas?

  • Related to selection screen

    Hi Experts, There is a selection screen. in that 6 radio buttons and 2 pushbuttons should be there. 6 radio buttons are rb1=Today, rb2= current month ,rb3= current year , rb4=all ,rb5= Pats and rb6= Future. 2 push buttons are (pb1 = key date and pb2

  • Why does firefox 3.6.15 close so slowly and erratically?

    '''bold text'''When I close down the web browser after viewing any web site, the window closes very slowly and erratically.

  • Extracting data from a field

    Hi, I have a comment field with manay information on it. One record will have text and date and numbers to it. I would like to pull the codes from 1001, 1002 up to 1012 from the field. Example comment: 1. 1005 9-30-09 update only 2. EDC 1008 9-15-09