CallableStatement,  how to get function result ?

Hello all,
I know that this issue more relevant to JDBC, but it seems that their forum is more "sleepy" than that one therefor i trying my luck here with you...
I've a pl/sql function which get 2 int arguments, and return float result
I use CallableStatement in order to execute pl/sql function.
with CallableStatement.setInt i transfer argument to the function,
but i dont know how to "catch" function result (as i said earlier, function results is float)
any help here...
Thanks
Edited by: igalep132 on Nov 21, 2009 4:47 AM

igalep132 wrote:
If you do have a PL/SQL function (specific syntax in PL/SQL) then you use the following form from the javadocs.
{?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
[http://java.sun.com/javase/6/docs/api/java/sql/CallableStatement.html]
that's exactly what i did, but my teacher assistant told me that it's wrong, because CallableStatement uses for stored Procedures, but I have here a function (because it returns a value...) therefor i need to use PrepareStatment/Statement...Third person accounts are always hard to judge, but what you are claiming is wrong (whether the TA said it or not.)
First a prepared statement can in fact be used to run either a proc or function. So can statement for that matter.
However callable statement is provided as a convenience to run procs and functions.
There can however be reasons why a driver doesn't allow that - I have used a driver that didn't support callable statements at all (procs or functions.)
That said the the format I gave you is specifically modeled for functions.

Similar Messages

  • Call function in background task... How to get the result?

    I want to use Call function in background task parameter.
    But I cannot find the result of this function. (No export parameter, no table result, no exception)
    How to get the result of this function module? Correct or not?

    Hi Heinz,
    You can check the result in SM58 transaction.
    For more information pls. refer this thread :
    No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
    Best regards,
    Prashant

  • How to get query result in comma dilimited text or excel file?

    Does anybody know how to get query results in comma delimited
    text file or excel file, I tried spool abc.txt, but the result
    showed some ------ lines
    Thanks

    Try doing this in your sql scripts
    set heading off
    set pagesize 0
    set linesize 4000
    set feedback off
    set verify off
    set trimespace on
    set colsep ","
    spool output.txt
    select * from dual (or whatever you are querying
    spool off
    There may be a couple other set statement that you could add but
    this should get you started in the right direction

  • Af:query - How to get the result rowsets

    Hi,
    I have a requirement where i need to search the db rows on and append the results the adf rich table on each search.
    For this i am using af:query component. And trying to get the result rows for the named criteria.
    String mexpr = "#{bindings.DestinDescVOCriteriaQuery.processQuery}";
    processMethodExpression(mexpr, queryEvent, QueryEvent.class);
    ViewCriteriaManager vcm = getDestinDescViewObj().getViewCriteriaManager();
    ViewCriteria vc = vcm.getViewCriteria("DestinDescVOCriteria");
    getDestinDescViewObj().applyViewCriteria(vc);
    AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
    adfFacesContext.addPartialTarget(tblDestinDesc);
    However on each click of search the rows searched in the previous attempt are not retained.
    Can anyone let me know how to get the result from named criteria and append it the table?
    Thanks
    Ajay

    Can anyone help?

  • How can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?

    how can i do with labview program,when i have   20 different values,and 1 want to add it with constant value.and how to get the results?

    Why do the 20 values have to be different? The same code should work even if some are equal.
    What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
    What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
    LabVIEW Champion . Do more with less code and in less time .

  • How to get the results for given Bind Variable

    Hi
    Can any one help me how to get the result rows from the View Object after executing the view object query by setting bind variable?
    snippet as follows
    viewObject.setNamedWherClauseParams("name","hei");
    viewObject.executeQuery();
    How to get the results from viewObject is my question..?
    Thanks in advance

    Should be something like
    while (vo.hasNext()){
    Row r = vo.next();
    r.getAttribute....
    You might want to read the "most commonly used methods" appendix in the ADF Developer Guide.

  • How to get function code of enter button in bdc manually

    hi
    i need to know how to get function code of enter button in bdc manually like in screen i want to capture techincal infor of enter buttion and itd fucntion cod ehow can i get it i mean what is the key in keyboard to display that
    i want to capture enter button and for eg status button etc funtion code
    pls suggest
    arora

    Hi,
    Want you need to do is go to transaction SHDB and record the bdc for the transaction you want, during transaction press the buttons for which you want the bdc code. And after this go press the back button and check the list of all the things recorded in Recorder.
    And for SHDB help check this link:
    http://abaplovers.blogspot.com/2008/02/recording-bdc-using-transaction-shdb.html
    Hope this helps.
    Regards,
    Qamar.

  • How to get the results in one line

    Hi
    if i use the script below i get the name of path and then : and in next line i get the results.is there a way to get the results from every path after the : and not in the next line?
    another question - is there a way that the script will not show the server name on every path?
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter
    THC

    If you take you script and pipe it to get member, it will give you a list of various script properties.
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter | get-member
    You will see that the object type returned by "Get-Counter" is Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet.
    TypeName:
    Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet
    Name MemberType Definition
    Equals Method bool Equals(System.Object obj)
    GetHashCode Method int GetHashCode()
    GetType Method type GetType()
    ToString Method string ToString()
    CounterSamples Property Microsoft.PowerShell.Commands.GetCounter.Perfo...
    Timestamp Property datetime Timestamp {get;set;}
    Readings ScriptProperty System.Object Readings {get=$strPaths = ""...
    You can try grabbing different properties, and they will print out differently, displaying the data on the same line in some cases. For example, pipe your output to a "foreach-object" block, and then for each object print out the CounterSamples property.
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter | foreach-object { ($_).CounterSamples }
    This should all print on one line now. However, you also asked if there was a way to not have the server print out on every line. The way to control the format of these outputs is to use the "format-table" cmdlet. So you would pipe your output to format-table
    and then give it various options. This is how you would pipe it (without any options).
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances |
    Get-Counter | object { ($_).CounterSamples | format-table }#OR USE YOUR ORIGINAL CODE(Get-Counter -ListSet LogicalDisk).PathsWithInstances |
    Get-Counter | format-table }
    Now, it's up to you to give format-table the options you want. With no options, output will look unchanged. To see what options are available to you, use get-help.
    get-help format-table
    I hope this helps!
    Thank for all the info...

  • How to get webservice result as "e4x" format in a professional solution?

    Hi. I want to get data from a .Net webservice as "e4x"
    format. It works when i use <mx notation to define the service
    in flex. However i want to build a more professional solution and
    want to implement the webservice as a class. But I can't get it to
    work such that i return the result as "e4x". Instead i get an
    object with arrays etc. The problems might be that i need to use
    the flex class operation to define "e4x" and then i need to bind
    the operation with the webservice but it seems that the webservice
    still doesn't know about to return the result as e4x. Here you see
    the code in <mx notation which is working fine:
    <mx:WebService id="WS" wsdl="
    http://localhost/testservice/service.asmx?WSDL"
    result="WS_onResult(event)" >
    <mx:operation name="HelloWorld" resultFormat="e4x" >
    <mx:request></mx:request>
    </mx:operation>
    </mx:WebService>
    And in the WS_onResult procedure i get the result by doing
    this:
    var xmlResult:XML = XML(event.result);
    As i said the above code is working fine but the code below
    doesn't work well because it doesn't return the result as "e4x":
    WS = new mx.rpc.soap.WebService();
    WS.wsdl = "
    http://localhost/testservice/service.asmx?WSDL";
    WS.addEventListener(LoadEvent.LOAD, load_listener);
    WS.addEventListener(ResultEvent.RESULT, result_listener);
    OP = new mx.rpc.soap.Operation(WS,"HelloWorld");
    WS.loadWSDL();
    And in the load procedure to perform the call:
    public function load_listener(event:LoadEvent):void {
    OP.resultFormat = "e4x";
    WS.HelloWorld.send();
    And in the result listener i get a result as object and NOT
    as "e4x". Can anyone help?
    Btw. here i add the .Net code:
    [WebMethod]
    public XmlElement HelloWorld() {
    XmlDocument doc = new XmlDocument();
    string xml = "<Test>this is a test</Test>";
    doc.LoadXml(xml);
    return doc.DocumentElement;
    }

    Hmm, try setting the resultFormat at the WS level. But what
    you have looks like it should work.
    Tracy

  • How to get Functional Location of a Workcenter?

    Hi there,
    I am looking for a function that brings me the functional location to a given workcenter of an operation (production order).
    In our case this is a one-to-one relation. In transaction IL03 I can see the workcenter on Location-tab. But how to get this functional location only with a work center that I know?
    How is this possible?
    Kind regards
    JetGum

    check if this [works>>>|http://www.sap-img.com/abap/customized-work-center-list.htm]

  • DbGetQuery = How to get the results to display?

    I am using the following
    sqldata <- dbGetQuery(con," select sysdate from dual")
    How do I get the result to display?
    summary(sqldata) displays the values
    if I do dbSendQuery then fetch show the results
    help(dbSendQuery) and help(dbGetQuery) go to the same page! dbSendQuery
    The documentation says dbGetQuery will connect, get the records and clear; maybe the clear happens before the display?!

    Hello Amin,
    Here is the way to display the result from the query you provided:
    Assign the result of the query to object 'sqldata':
    R> sqldata <- dbGetQuery(con," select sysdate from dual")
    Type the object name at the R prompt:
    R> sqldata
                  SYSDATE
    1 2014-04-28 14:45:14
    Sherry

  • M-Audio Fast Track, how to get best results?

    Hey guys.
    I just got my M-Audio Fast Track. It seems quite cool. Not really to sure what to do with it though!
    I'm using it to record guitars and vocals into GB.
    So how can i set it up to get best results?
    Right now I have my Audio System Preferences set to Built in Audio for In and Out, but in GB preferences I have Input set to FastTrack and Out set to Built-In...
    It seems to be quite quiet, quieter than if i plug my guitar directly into the iMacs line in...?
    Cheers
    jim
    P.S. Please don't bother writing about how I should have bought a Firewire device or anything else, I'm a cheap *** student, I bought what I could!

    Jim
    I have just bought one and the sound is good. I monitor sound thru my HI_FI system. The settings I have are:
    1. Leave sound settings alone in system preferences.
    2. In GB2 I have set input and output devices to fast track. (By the way there are no drivers available for this device - it is natively supported by OS X)
    To adjust volume I have to adjust the right hand output volume knob on the front of the Fast track. My G5 system volume control has no effect on the fast track.
    Andrew

  • How to get two Results  - Sum and Average for one KeyFigure

    I have "Material" in Rows and "Cal Year/Month" in Columns and also KeyFigure "Qty" in Columns.
    The Results (Yellow) of "Qty" is defined as "Avg of all values <>0". This works fine but how do I get two Results - one is a "Sum" and the other "Avg" for just one KeyFigure. The output basically should look like below:
          Cal Yr/Month  01/2006   02/2006   03/2006...    Result        Result
    Material                   Qty       Qty           Qty       Sum of Qty   Avg of Qty
    ABC                       100         0             200            300             150     
    DEF                       100         200          300            600             200     
    GHI                        500         300          400           1200            400

    Hi Srinivas,
    I think you must use Restricted Key Figures and Formula.
    Do not introduce CALMONTH in columns, but restrict 12 times the Key Figure Qty with 0CALMONTH3, that is 01-02-03-...
    Then create a Formula that is the Sum of all Restricted KF and call it SUM.
    Then copy the previous Formula (SUM) and call it AVG and give the option of Average of all Values <>0.
    Try.
    Ciao.
    Riccardo.

  • How to get Test Results to SQL w/o Coldfusion

    Is there a way to get Captivate test results (or any results)
    to SQL. I was thinking of using the SCORM interface?
    A simple elegant solution would be great since I want to
    build it into to all my componants.
    Thanks in advance,
    Scott

    If your organization is running Sharpoint 3.x, you can use
    the sharepoint learning kit which runs off of a sql back end. This
    is a SCORM 2004 compliant LMS that can be found here:
    http://www.codeplex.com/SLK
    If you want to do this without an LMS, you can set up your
    quiz to just send the score as in this article:
    http://www.adobe.com/devnet/captivate/articles/store_cpresults_print.html
    You steal the idea from here, but in your javascript, you can
    do a pass your variables (quiz resutls), to an asp.net page that
    places them into a SQL db. I'm working on such a solution right
    now. That way, you don't need an LMS and you have complete control
    over how and when the results are stored.

  • How to get accurate results from sql code ?

    Hello everybody,
    I have a problem with some portion of my code.
    I get more results than I specify in the where clause.
    Here is the sample code:
    c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
    and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
    For some reason I also get the following results back:
    110-6910-51001-001, and 110-6910-51003-001 But I don't need the 51001 and 51003. How do I specify in sql what range I really want. I was sure that the code above is correct. I guess not.
    I would appreciate any help,
    Thanks,
    Sonya

    Have you tried using the query either of the following...
    1) c.gl_acct_id between '110-6890-69000-000'
    and '110-7000-67999-999'
    and c.gl_acct_id not like '110-6910-51001-%'
    and c.gl_acct_id not like '110-6910-51003-%'
    assuming you have only 3 digits at the end of gl_acct.
    2)If you know that your acct_id belongs to only 69000 or 67999
    then
    (c.gl_acct_id LIKE '110-6890-69000-%' OR
    c.gl_acct_id LIKE '110-7000-67999-%' )
    Plz. let me know if this not what you are looking for.
    thanx
    rajkiran
    Here is the whole script:
    select distinct c.gl_acct_id acct_no,
    c.gl_acct_desc,
    min(a.local_act_beg_bal) local_act_beg_bal,
    sum(b.local_act_mtd_dr_amt) debits,
    sum(b.local_act_mtd_cr_amt) credits,
    nvl(min(a.local_act_beg_bal),0)+sum(nvl(b.local_act_mtd_dr_amt,0))-
    sum(nvl(b.local_act_mtd_cr_amt,0)) end_bal
    from gl_acct c, gl_acct_bal a, gl_acct_bal b
    where c.org_unit_id = '110'
    and b.gl_acct_id = c.gl_acct_id
    and a.gl_acct_id = c.gl_acct_id
    and c.sum_det_ind = 'D'
    and c.gl_acct_class_ind in ( 'A' , 'L' , 'Q' , 'I' , 'E' )
    and a.year_no = '2001'--:loyear
    and a.period_no = '1'--:loperiod
    and ( ( b.year_no = '2001'--:hiyear
    and b.period_no between '1'--:loperiod
    and'13')-- :hiperiod
    and c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
    and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
    group by c.gl_acct_id, c.gl_acct_desc
    I want to have ability to specify ranges for gl_accoount.
    Thanks,
    Sonya

Maybe you are looking for

  • Tax rates to be changes in scheduling agreement

    I have lots of scheduling agreement which have been released as well. Now as per the new budget, we created new condition records and maintained new tax rates (excise duty from 12 to 12.50%). we have a z program to perform GRN and it has logic writte

  • HTTP Connection to R/3 System error- HTTP/1.0 404 Not found

    Hi, I am using a HTTP connection to XI to extract data from R3 to XI. The HTTP connection I have created in R3 are getting an error - "HTTP/1.0 404 Not found" while testing the connection. Porperty maintained in the connection: Terget host = <XI serv

  • Webcenter error when running application

    hi am having below error when running my application am in jdeveloper 11.1.1.6.0 <10 Nov 2012 8:51:37 AM> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1352530297019' for task '0'. Error is: 'weblog

  • Itunes won't launch on Windows XP

    I have in the last few days downloaded itunes 7.5 for my ipod classic 80 gb. When i click the icon to bring itunes to screen I get an error message 'iTunes has encountered a problem and needs to close. We are sorry for the inconvenience' the Error si

  • Excel (desktop)

    I seem to have two different versions of Excel on my PC.  The problems started when I upgraded from windows 8 to windows 8.1 If I am in windows explorer and I right click on an excel file and choose 'Open with' I am given three choices: Excel (deskto