How to Return ten records into java class by using oracle stored procedure

Hello sir/Friends
There is a procedure that returns 10 records from the oracle table and i want to display all 10 records into the table in java class.
Please reply
Thanking you.

When you execute the stored procedure it will return your results as a ResultSet. Iterate over itto get the values you need then do with them as you please.
        List<MyObject> results = new ArrayList<MyObject>();
        MyObject mo = null;
        ResultSet rs = stmt.executeQuery("SELECT a_value FROM a_table");
        while (rs.next())
            mo = new MyObject();
            mo.setValue(rs.getString(1));
            results.add(mo);
        }

Similar Messages

  • Calling a java class from an oracle stored procedure

    my oracle stored procedure is:
    create or replace
    PROCEDURE openpdffile
    AS LANGUAGE JAVA
    NAME 'pdfopenbook.mainbook()';
    it is valid and so is this java class;
    import java.sql.*;
    import oracle.jdbc.*;
    public class pdfopenbook //class pdfopen
    public static void mainbook(String args[]) //main function
    try //try statement
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "c:\\temp\\final_book.pdf");
    // Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "sol.exe");
    } catch (Exception e) //catch any exceptions here
    System.out.println("Error" + e ); //print the error
    but i get the error:
    onnecting to the database caprs.
    ORA-29531: no method mainbook in class pdfopenbook
    ORA-06512: at "CAPRS.OPENPDFFILE", line 1
    ORA-06512: at line 2
    Process exited.
    Disconnecting from the database caprs.
    it says there is no mainbook method but there is, what am i doing wrong??
    Thanks,
    Doug

    http://wiki.answers.com/Q/Can_you_call_a_java_function_from_an_oracle_stored_procedure

  • How to pass MDM Record ID in Webdynpro to use in Guided Procedure

    Hello Experts,
    I am facing the following requirement. I Have two WebDynpro Screens calling an MDM Item Detail View.
    I want to set up an easy process using Guided Procedure.
    Therefore I need to pass an internal ID from Screen A (request) as an input Parameter for screen B (approve).
    How can I handle this in my wrapper application? Is did not find any guides. You have some ideas?
    I should throv an "saveRecord" Event containing this ID to a event listener (Screen B).
    Sorry I am a beginner in WD :o)
    Thanks in advance
    Carsten

    Hi,
    You can try doing this way in the application
    1. check if the record is checked out,
    If yes, then get the original record id via the command RetrieveOriginalsByCheckoutRecordCommand.
    else
    You have the original record Id in hand.
    Best Regards,
    -Prashant.

  • How to Pass parameters to Crystal report 10 based on Oracle Stored Procedur

    Hi,
    I use the following code to pass the parameters:
    Rep.Tables[0].ConnectBuffer := Connection_Str;
    Rep.Tables[0].AliasName := 'REP';
    Rep.Connect.Propagate := True;
    Rep.ParamFields.ByName('Lang', '').CurrentValue := IIF(BiDiMode = bdRightToLeft, '2', '1');
    Rep.ParamFields.ByName('SESSION_ID', '').CurrentValue := IntToStr(Session_id);
    Rep.WindowState := wsMaximized;
    Rep.Show;
    The 1st parameter 'Lang' which created from crystal report pass well,
    but the 2nd parameter 'SESSION_ID' which created from Oracle Stored Procedures give the following Error:
    Error: 202 Parameter Name could not be found u2013 ParamFields.ByName
    However in MS SQL Server the above code work fine with the 2 Parameters.
    Any one has solution,

    Hello,
    Click on the businessobjects Tab above and then select Samples and dowload the sample app you for your SDK. There are a few samples for changing/setting Parameters.
    The Parameter collection has all parameters.
    Thank you
    Don

  • Error calling Java in Oracle Stored Procedure

    I can call a java function inside my Oracle Stored Procedure, but if I reference a class that uses JNI, I get problems. I don't know what forum to post this under. This seems the closest match.
    Here is my error:
    java.lang.NoClassDefFoundError
    at AcmeComp.ec.Motor.<init>(Motor.java:35)
    at BBOra.runBB(BBOra:13)
    Here is my java class, BBOra.java:
    import AcmeComp.ec.*;
    class BBOra {
    static String strCnt;
    BBOra() {}
    public static void runBB() {
    try {
    //Motor class is in AcmeComp.ec package
    Motor eng = new Motor();
    } catch(Exception e) {
    System.out.println("Error: " + e);
    public static void runNonBB() {
    System.out.println("runNonBB works ok.");
    From DOS prompt, I loaded ac222ec.jar (has the AcmeComp.ec package) and BBOra.java files into Oracle:
    loadjava -u system/manager -resolve -verbose ac222ec.jar.java
    loadjava -u system/manager -resolve -verbose BBOra.java
    From SQL Plus, I created 2 stored sprocedures:
    CREATE OR REPLACE PROCEDURE runBB
    AS LANGUAGE JAVA
    NAME 'BBOra.runBB()';
    CREATE OR REPLACE PROCEDURE runNonBB
    AS LANGUAGE JAVA
    NAME 'BBOra.runNonBB()';
    From SQL Plus, I gave myself permissions to load libraries, so I can load ac222ecjni.dll, which has all the Native (C++) code I use:
    BEGIN
    DBMS_JAVA.GRANT_PERMISSION('SYSTEM',
    'java.lang.RuntimePermission',
    'loadLibrary.*');
    END;
    From SQL Plus, I set up my output:
    set SERVEROUTPUT ON;
    CALL dbms_java.set_output(3000);
    From SQL Plus, I called my Stored Procedures:
    CALL runNonBB();
    CALL runBB();
    runNonBB() works great, but runBB() gives me the error I listed above. The Motor class that BBOra calls, itself calls a class NMotor, which has a call:
    static {
    System.loadLibrary("ac222ecjni");
    Unfortunately, I don't know the inner workings of the native code. Does "at AcmeComp.ec.Motor.<init>(Motor.java:35)"? mean JServer was able to see the class "Motor", but not instatiate it? Or did it error trying to create the class "NMotor"?
    Here's a snippet of Motor:
    package AcmeComp.ec;
    public class Motor implements IMotor {
    public Motor() {
    motor = new NMotor();
    some functions
    private NMotor motor;
    Here's a snippet of NMotor:
    package AcmeComp.ec;
    class NMotor {
    NMotor() {
    sunjdk = true;
    some native method declarations
    private boolean sunjdk;
    static {
    //ac222ecjni.dll has all the Native (C++) code
    System.loadLibrary("ac222ecjni");
    PLEASE HELP ME FIGURE THIS OUT. IT IS KILLING ME. I can even look into the USER_OBJECTS view in Oracle and see that ALL of the classes from the ac222ec.jar are present and accounted for.

    Man, I guess I figured it out myself. Ten Duke dollars to myself. But, for the sake of anyone who may want to know the answer, here it is:
    JServer (or Oracle9i JVM in Oracle 9i) does not support JNI. Here is their (weak) reasoning, taken from "Oracle9i Java Developer's Guide" as found in http://www.csis.gvsu.edu/GeneralInfo/Oracle/java.920/a96656/invokeap.htm#1007948
    "Oracle does not support the use of JNI in Oracle9i Java applications. If you use JNI, your application is not 100% pure Java, and the native methods require porting between platforms. Native methods have the potential for crashing the server, violating security, and corrupting data."
    Sounds like a fancy way to say they have a limitation--their JVM isn't up to par all the way. If JNI is a feature in Java, why should Oracle decide for me if I should use it? Don't Java methods also have the potential for crashing the server, violating security, and corrupting data? I think they should just provide the functionality you would expect from a VM and let the user decide which functionality to use. In my case, I HAVE to use JNI, so I'd have to use RMI so that a different VM can do the JNI part.
    Sounds pretty lame of Oracle, but oh well.

  • Inserting multiple rows into DB via SQL insert or stored procedure?

    I have successfully created an application where I select a row in an output table view from a Microsoft Access DB SQL data source, and get an Oracle stored procedure to save the row in a new table in our Oracle DB.
    This works like a charm when selecting one single row in the table view. What I really need though is for the procedure to save multiple rows at once.
    My table is configured with selection mode = 'multiple', and the data mapping line between the table and my procedure has mapping scope = 'selected data rows'.
    So, I am able to select multiple rows but still my procedure only stores one of the values sent. Does anyone know if this is related to my procedure not handling multiple parameter entries or if it's related to how VC outputs data to a procedure?
    Here is output from runtime flex log where you see the three values: 3, 11 and 9 that is sent to the procedure's IN parameter 'P_ID'.
    <Row OWNAPPS_TESTSQL_HYTTER_P_ID="3"/><Row OWNAPPS_TESTSQL_HYTTER_P_ID="11"/><Row OWNAPPS_TESTSQL_HYTTER_P_ID="9"/>
    Please help
    Henning Strand
    I am still very, very interested in hearing if anyone has been successful at passing multiple rows to a stored procedure in one submit action.
    Edited by: Henning Strand on Apr 11, 2008 1:58 PM

    Update for all you happy people using Oracle stored procedures with Visual Composer:
    When trying to run a simple procedure that accepts arrays as input parameters, the JDBC connector returns an error message saying: 'PLS-00306: wrong number or types of arguments in call ...'
    I registered this as a customer message with sap support and got an answer back saying:
    Unfotunately our JDBC connector is still not able to work with SP that contain arrays, this is the reason for the behaviour that you're seeing.
    This are the bad news, the good news is that with WebServices we don't have this limitation, so you can achieve the same results by using a WS instead of the Store Procedure.
    I have asked if and when using stored procedures with arrays will be supported - waiting for answer.
    Henning Strand

  • How to call Oracle Stored Procedure using EDQ

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

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

  • How can i use JWSDP1.6 from Ant tool to convert .wsdl file into Java class

    Hi All,
    i m very new in the development field.plese help me...
    i have a .wsdl file and i have to make some modification in the file and return this file with build file used in Ant tool.
    means my requirement is to conver the .wsdl file into java class,modify it and convert back to wsdl file.how can i do it using JWSDP1.6 and Ant tool.
    thanks in advance...
    Vikram Singh

    lemilanais wrote:
    hello!
    I have developpe an animation with flash. before give it to othe person in order to use it, i would like to secure it by integrated a security module inside the software.Secure it from what? Being played? Copied? Deleted? Modified?
    Because, i am a java developper, i have choose Netbeans 6.1 to secure it.That has to be the most random thing I've read in some time.
    do you know how can i do to integrate my animation .swf inside my java class?Java can't play SWF files and Flash can't handle Java classes, so what you're suggesting here doesn't make a lot of sense.

  • How to convert Property files into Java Objects.. help needed asap....

    Hi..
    I am currently working on Internationalization. I have created property files for the textual content and using PropertyResourceBundles. Now I want to use ListResourceBundles. So what I want to know is..
    How to convert Property files into Java Objects.. I think Orielly(in their book on Internationalization) has given an utitlity for doing this. But I did not get a chance to look into that. If anyone has come across this same issue, can you please help me and send the code sample on how to do this..
    TIA,
    CK

    Hi Mlk...
    Thanks for all your help and suggestions. I am currently working on a Utility Class that has to convert a properties file into an Object[][].
    This will be used in ListResourceBundle.
    wtfamidoing<i>[0] = currentKey ;
    wtfamidoing<i>[1] = currentValue ;I am getting a compilation error at these lines..(Syntax error)
    If you can help me.. I really appreciate that..
    TIA,
    CK

  • How to return a record's column head given a record of a table.

    Hi:
    Do you know how to return a record's column head given a record of a table.
    For example, in a table with 3 columns "ID", "Education", "Age".
    Give you the record "Bachelor", how can you use a SQL to return the correspondent column head "Education"?
    Thanks for the big help.

    Have a look at http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSetMetaData.html.
    import java.sql.*;
    import java.util.*;
    ResultSet rs = stmt.executeQuery("SELECT * FROM testTable");
    ResultSetMetaData rsmd = rs.getMetaData();
    // loop through rsmd.getColumnCount() {
         String columnName = getColumnName(i);
         // run a query SELECT * FROM testTable WHERE columnName='Bachelor'
         // if rs !=null return columnName and break out of the loop
    }

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • Asset related question - How to add a record into table ANLC?

    Hello experts,
    Could anyone tell me how to add a record into table ANLC?
    Thanks very much!
    Christina.

    how you want add?
    you want add direct in table???.
    Normally if yo post any transaction this table will update.
    ex;acquisition;
    chandra

  • How do i show vbscript into java application?

    hi
    how do i show vbscript into java application? ( looks like microsoft frontpage)
    or what is interpreter of vbscript for java ?
    thank you?

    There probibly isn't one.
    vbscript and java are rather different. You are better of opening a vbscript viewer from java as a sperate program.

  • How do i show javascript into  java application?

    hi
    ( please help me!!!!!!!!!!!!!!!!!)
    how do i run javascript into java application ?( looks like microsoft frontpage )
    thank you ?

    There is a JavaScript interpreter called Rhino implemented in Java, maybe you can use it: http://www.mozilla.org/rhino/

  • Binding XML to java types generated using Oracle Class Gen

    Hi,
    how can you bind an XML to the java types generated using the class gen provided byOracle.
    I am using oracle 9i production. as part of my design, i have to read an xml input in my java class and use the contents to create some records and send a response xml back.
    The latter part of i can do as the java types provide setter methods to set the data and conversion to xml.
    Jaxb can be using to bind xml to java datatypes but its not supported in Oracle9i.
    What are the alternatives for achieving the same?
    Thanks
    Ashwin

    Hi Ashwin,
    This is a bit outside my area of expertise, but I did run an older version of TopLink in the Oracle database java VM a few years back so I'll base my advice on that. Hopefully other forum members can correct me if I steer you wrong.
    First you will need to set up your XML environment:
    I believe the Oracle 9i database includes a JDK 1.3 VM. You will first need to determine if the VM includes any JAXP APIs. I believe there is an SQL query that allows you to query the classes available in the VM. First check if javax.xml.parsers.DocumentBuilderFactory is present.
    If the JAXP APIs are already present in the database you will need to do the following. First load the class javax.xml.namespace.QName into the database. You can extract this from xmlparserv2.jar or from Suns Java Web Service Developer Pack jax-qname.jar. Then you will need to load the JAXB APIs. You can load xml.jar or jaxb-api.jar from Sun's JWSDP.
    If the JAXP APIs are not present you will need to load the 10.1.3 version of the XDK jars (these are shipped with the 10.1.3 TopLink install). Load xmlparserv2.jar and xml.jar into the database.
    Second you will need to setup your TopLink environment:
    Load toplink.jar into the database. If the JAXP APIs were already present and you didn't load the 10.1.3 XDK jars into the database you will need to set the following System property.
    toplink.xml.platform=oracle.toplink.platform.xml.jaxp.JAXPPlatform-Blaise

Maybe you are looking for

  • Cannot install windows support software

    1 month old MBP running 10.7.1 trying to BootCamp  Win7 Ultimate x64 (all OSX updates have been installed that were found prior to attempted install) Some help would be greatly appreciated. I have installed Windows to a BootCamp partition but I'm una

  • Why my credit card cannot be used in iTunes?

    Why my credit card cannot be used in iTunes?

  • Configuratio help required

    Hi I need Help in configuration.. for the Below scenario..   1 we are getting data from Proxy in MsgA    2. We are mapping the MsgA to MsgB(intermediate Structure) in SAP-PI   3. Then This would goes to BPM . (Final Msg type is different i have the d

  • Can't restore windows

    I have this problem with finder and vlc where if I minimize them to the dock I cannot restore them. For vlc the menu bar at the top changes and I have to go to 'Window-Main Window' to get the the window to appear. But for finder the menu bar does not

  • Header text flow from ME51n to ME21N

    Hi Experts,                    I will enter header text in ME51N (PR creation) and save that .In ME21N  that header text should flow while I refer the PR number .Please tell me what badi should be used and how to use d same. I am new to BADI.Help me