How to pass RECORD input type to stored procedure from JDBC?

Hi,
We have stored procedure which takes RECORD as input .
We could execute the below script from oracle client tool and get the response.
declare
l_record app.batch_update.add_record;
l_id number;
begin
-- memberNumber
l_record.no := '123456700';
-- Policy Number
l_record.pno := '1234567'
-- Status. This will always be NEW.
-- Call to API to add record
app.batch_update.add_request
(p_record => l_record,
p_id => l_id,
end;
We have requirement to construct RECORD input from Java application and pass it to callable statement.
We have tried to construct it via STRUCT and pass it to callable statement but it didn't work.
We have constructed it like the following but not sure whether it is correct. It was throwing error "java.sql.SQLException: invalid name pattern: app.batch_update.add_record
StructDescriptor structdesc = StructDescriptor.createDescriptor
("app.batch_update.add_record", delConn);
Object[] p1obj = {' 12345','124050'};
STRUCT p1struct = new STRUCT(structdesc, delConn, p1obj);
Not sure whether I am doing the logic correctly.
Please point me to the correct approach.
Thanks in Advice
Thanks

Wrap the method using a record-type parameter in PL/SQL; a simplified example follows. Add exception handling, translation of types etc. as needed.
CREATE OR REPLACE PROCEDURE prc_wrap_prc_using_rec
pv_my_field_01 IN VARCHAR2,
pv_my_field_02 IN VARCHAR2,
pv_my_field_99 IN VARCHAR2,
pv_err_msg OUT VARCHAR2
) AS
-- Non-scalar parameter
pr_my_record user.pkg_rec_declarations.wr_a_record_decl;
BEGIN
-- Load the work record
pr_my_record.pv_field_01 := pv_my_field_1;
pr_my_record.pv_field_02 := pv_my_field_2;
pr_my_record.pv_field_99 := pv_my_field_99;
-- Call the procedure
pkg_std_routines.prc_do_sumfin(pr_my_record, pv_err_msg);
END;

Similar Messages

  • How to pass an array to a stored procedure

    create or replace package demo_pkg
    as
    type cityArray is table of city%rowtype index by binary_integer;
    procedure city_report( p_inputs in cityArray );
    end;
    CREATE OR REPLACE PACKAGE BODY demo_pkg
    AS
    PROCEDURE city_report (p_inputs IN cityarray)
    IS
    BEGIN
    FOR i IN 1 .. p_inputs.COUNT
    LOOP
    DBMS_OUTPUT.put_line ( 'citycode = '
    || p_inputs (i).city_code
    || ' CITYDESCRIPTION = '
    || p_inputs (i).city_description
    INSERT INTO testing
    (city_code, city_description
    VALUES (p_inputs (i).city_code, p_inputs (i).city_description
    commit;
    END LOOP;
    END;
    END;
    to call that procedure ia m using this
    declare
    my_data demo_pkg.cityArray;
    begin
    my_data(1).city_code := 1234;
    my_data(1).CITY_DESCRIPTION := 10;
    my_data(2).city_code := 4567;
    my_data(2).CITY_DESCRIPTION := 20;
    my_data(3).city_code := 4321;
    my_data(3).CITY_DESCRIPTION := 30;
    demo_pkg.city_report( my_data );
    end;
    but actually the procedure (demo_pkg.city_report)is called from front end(.net).how they will call this procedure in .net invironment

    Hi,
    Your exact question has been asked before, see: http://asktom.oracle.com/pls/ask/search?p_string=How+to+pass+an+array+to+a+stored+procedure
    or do a search on this forum.
    And please use this tag => (yes, just the 4 characters forming the word 'code' between curly brackets)
    *before* and *after* your example to maintain formatting and indentation, it's hard to read now....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to pass the parameter of a stored procedure to iReport

    Hi... i don't know how to pass the parameter of the stored procedure to the iReport.
    In the Report Query, i tried
    1. sp_storedprocedure ' value'
    2. sp_storedprocedure +''''+$P{parameter}+''''+
    3. sp_storedprocedure +$V+$P{parameter}++$F($F is a variable having a value of ' (a single quote))may you enlighten us please? thank you

    For M$ SQL server I find that it only works when U use the fully qualified name...
    e.g. catalod.dbo.my_procedure_name 'variable'
    My full query in the Report Query window is something like this:
    EXEC arc.dbo.jasper_Invoice 1000
    Note that you may find that selecting from VIEWS / TABLES fails for no apparent reason and iReport will prompt you with the usual very unhelpful (we have what we "pay" for) prompt, stating that "The document is empty".
    To work around this issue, where a statement like "SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id=1000" does not work, simply create a PROC, something like:
    CREATE PROC jasper_MyProc (@my_rec_id integer) AS
    SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id= @my_rec_id integer
    ...to wrap your SELECT statement, then call the PROC
    Edited by: Sylinsr on Apr 22, 2008 4:23 PM

  • How to pass javascript variable to PLSQL stored procedure

    Hi,
    How can I pass a javascript variable to a database procedure. I have a form with a radio button group and would like to save the value of the selected radio button to a database table by passing the value to the stored procedure.
    Thanks

    Hi
    You can use iframe to call the procedure. Here is an example used in dynamic page or pl/sql portlet. The pl/sql procedure is called myprocedure and resists in the schema myschema. This example passes 2 parameters, but I have not yet reased a limit.
    First the call within a javascript function:
    myiframe.location.href="myschema.myprocedure?p_myprameter1=" + vJvascriptparameter1 + "&p_myprameter2=" + vJvascriptparameter2;
    Then the iframe:
    <iframe id="myiframe" height="0" width="0" frameborder="0"></iframe>
    You can let the pl/sql procedure print a value, that can be used i the portlet. You can get the value in a javascript this way:
    myvalue=top.window.frames["myiframe"].document.body.innerHTML;
    Best regards
    Klaus

  • Passing PL/SQL Record to a Oracle Stored Procedure from Java.

    Hi There.
    Can someone let me know how to pass pl/sql records in java/oa framework. For E.g :
    Package Specification:
    create or replace package pkg is
    type rec_type is record (n number, d date, v varchar2(1));
    rec rec_type;
    procedure p (r IN rec_type);
    end ;
    Package body :
    create or replace package body pkg is
    procedure p (r IN rec_type) is
    begin
    dbms_output.put_line('The values passed to the procedure are' || r.n||r.d||r.v);
    end p ;
    end pkg;
    Actual pl/sql Call (I need counter part of below code in Java)
    declare
    r1 pkg.rec%type;
    begin
    r1.n := 7; r1.d := sysdate; r1.v := 'R';
    pkg.p(r1); -- > How to do similar call using OracleCallableStatement
    end;

    Hi
    I am not sure whether you have check [this.|http://mukx.blogspot.com/2007/12/passing-plsql-table-to-java-using.html]
    Thanks
    Shailendra

  • Passing XMLType Data into oracle stored procedure using JDBC

    Hi Friends,
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.
    Following are the environment details
    JDK Version: 1.6
    Oracle: 10g
    Server: Tomcat 6.x
    Thanks in Advance

    user4898687 wrote:
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.As stated - no.
    A 'file' is a file system entity. There is no way to pass a 'file' anywhere. Not PL/SQL. Not java.
    Now you can pass a file path (a string) in java and to PL/SQL.
    Or you can pass xml data (a string) in java and to PL/SQL. For PL/SQL you could use eithe a varchar2, if the xml is rather small, or a blob/clob.

  • Calling Stored Procedure from JDBC MSSQL

    Ok, I have a stored procedure on a MsSQL Server 2000 data base. I need to call it to encrypt/decrypt passwords, my problem is when I run it from Query Analyzer it works fine but not in JDBC land. Below I have included my code. I have read you need to use a callable statement, but my query has a proc call embedded in it, not just a proc call. Anyone know how this would be accomplished?
    THanks in Advance
    try {
                   // create an insert query
                   StringBuffer query = new StringBuffer();
                   // add strings and variables to query
                   query.append("INSERT INTO ");
                   query.append("users (Company, FirstName, LastName, Username, ");
                   query.append("Password, Email) ");
                   query.append("values(");
                   query.append("'" + form.getCompany() + "', ");
                   query.append("'" + form.getFirstName() + "', ");
                   query.append("'" + form.getLastName() + "', ");
                   query.append("'" + form.getUsername() + "', ");
                   query.append("dbo.fn_sys_encryptpwd('" + form.getPassword() + "', '" + key + "'), " );
                   query.append("'" + form.getEmail() + "')");
                   // get the datasource from the From the context
                   DataSource dataSource = ResourceLocator.getRCDataSource();
                   // open a connection
                   Connection conn = dataSource.getConnection();
                   // make a statement and execute it
                   CallableStatement statement = conn.prepareCall(query.toString()) ;
                   //Statement statement = conn.createStatement();
                   statement.execute();
                   // Insert has been performed...destroy the statement and connection.
                   statement.close();
                   conn.close();
              }

    I tried with Statement first then I tried with the PreparedStatement, but neither one worked. I have inlcuded part of the stackTrace to give you an idea of my problem
    Thanks
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'dbo.fn_sys_encryptpwd'.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown
    Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown
    Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(
    Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Sour
    ce)
    at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType
    (Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
    at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
    at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
    at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(Deleg
    atingPreparedStatement.java:168)
    at com.retailcode.web.data.dao.LoginDAO.createLogin(LoginDAO.java:81)
    at com.retailcode.web.submit.SubmissionServlet.postRegister(SubmissionSe
    rvlet.java:226)
    at com.retailcode.web.submit.SubmissionServlet.doPost(SubmissionServlet.
    java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
    rocessConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
    int.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
    lowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:684)
    at java.lang.Thread.run(Unknown Source)

  • Calling Stored Procedure from JDBC Adapter

    Hello,
    I am Updating a SQL Server Table using JDBC Adapter.
    Now I have multiple input rows and the procedure needs to be called for each set.
    Do I need to use multimapping for this or just generating multiple <b>Statement</b> node will solve?
    Also For this will there is any knows/ forseen problem (like Transaction handling) that I need to take care of?
    Thanks and Regards,
    Himadri
    Message was edited by:
            Himadri Chakraborty

    Himadri,
    You can just create multiple statement nodes in one message.
    I am not aware of any known or foreseen issues with this approach.
    Kind regads,
    Koen

  • Stored procedure from JDBC in VC

    Hello
    We're starting to use VC 7.0 SP14.
    We've already made few applications using JDBC tables or view and BAPI.
    Now we want to use stored procedures of the same DB.
    Our DB system was created as a "SAP_BI_JDBC". But when I look in VC, I can see my system but it only proposes me to "look for a table" or to "browse table catalog". Here I don't see my stored procedures.
    Hence, I tried to create a "JDBC Systems" but now I can connect to it (connection test fail).
    Can any one help by giving me the parameters to use on the DB side, or portal's system parameters, ...
    Thank you !
    Benoit

    Hi,
    You test the Connection in the prortal if it fails then it is problem woth Usermapping.
    Do the usermapping for that DB
    then try again
    Govindu

  • Invalid Object when Calling Stored Procedure from JDBC Adapter

    JDBC Outbound adapter in XI 2.0 connected to SQL Server.  I've coded my mapping to format the XSL mapping properly but the Adapter appears to not be able to find the Stored Procedure.  Error message returned is "Invalid Object spStoredProcedureName".
    Does anybody have any clue as to what I'm missing???

    I know this is trivial, but did you use the "full" name of the SP as <schema>.<procname>???
    HTH

  • Invoke stored procedure from JDBC Adapter

    Is there a tool that generates interfaces for stored procedure(ORACLE PL/SQL) like RFC or IDOC adapters?

    Hi Denis,
    I dont think there is any such tool.]
    To generate a Stored Procedure of your Oracle DB, all you will have to do in your <b>JDBC adapter configuration</b> is give the name of the Stored Procedure under <Table> and you will have to give "<b>execute</b>" as the value under action attribute.
    Just check this link. Hope it helps,
    http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/content.htm
    Just check this blog of Sriram wherein a stored procedure of a MaxDB Database is called.
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    I have implemented a scenario which requires an Oracle stored procedure to be executed and so, if you do need any further info, let me know.
    Hope this info helps,
    Regards,
    Bhavesh

  • Urgent! Call stored procedure from jdbc vs. call from sqlplus?

    Hello I met a strange problem when using JDBC (to Oracle). I have a stored procedure mypack.myproc, which updates a table (only one row and one column in the table). I found that when I called the procedure directly from sql*plus, like:
    ==========
    BEGIN
    mypack.myproc;
    END;
    ==========
    the value is 2, which is correct.
    However, if I call the procedure from with in java via jdbc, the value become 591 (which is ridiculous), the jdbc call looks like:
    ================
    cstmt = con.prepareCall("{call mypack.myproc}");
    cstmt.executeUpdate();
    con.commit();
    ================
    This is really wield, Any idea?
    Thanks

    Hey buddy, it's you again. Just let you know that you are right. The problem is caused by mis-match between jdbc date and oracle date (that procedure is used to do some date calculation). My co-worker suggested me to add this statement in the procedure, and it did solved problem:
    ================
    DBMS_SESSION.SET_NLS( 'NLS_DATE_FORMAT', '''DD-MON-RRRR''' );
    ================

  • How to pass global variables to call stored procedure in form personalizati

    Hi,
    We want to call a custom store procedure with 2 paramterts, I am storing values into 2 global variables.
    We want call the custom store procedure with global variable values in form personalizations.
    We tried like
    ='declare
    begin
    SUR_TEST_ORDER_LINE_UPD.update_order_line (:global.xx_line_id, :global.ship_set_id);
    end'
    Could you please suggest.
    Advance Thanks
    Subbu

    Hi,
    Doc number (MOS Doc 743490.) is avaiable in metalink or ?Yes.
    Note: 743490.1 - Customization in Oracle Applications
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=743490.1
    Regards,
    Hussein

  • Passing dynamic parameter to stored procedure from CR formula?

    Dear all,
    I need to insert in some textboxes the right string based on the desired Language Code.
    I crated a stored procedure in my db.
    CREATE PROCEDURE MY_GET_TRANSLATION
         @TextID nvarchar(8),
         @LangCode int
    This parameters are used as keys to get the Trans field.
    I created a workshop formula: GetTranslation
    Please, can someone suggest the correct statement to call my MY_GET_TRANSLATION  stored procedure passing parameters?
    I would like to call the GetTranslation formula from all my textboxes, passing the specific TextID value
    and visualized the right translated string.
    For example:
    in my TEXT1 textbox, I would like to call the GetTranslation formula passing the parameters
    TextID = "T000001"
    and
    LangCode = 13    (Italian language)
    How can pass dynamic parameters to a formula?
    How can pass dynamic parameters to a stored procedure from a CR formula?
    Regards
        Emanuele

    Dear Jason,
    I'm trying to modify a SAP B1 CR marketing report.
    This CR marketing document is called by SAP B1 automatically passing the Document Number and Document Type.
    The report uses the right SAP B1 tables to read the information of the header and rows of the document.
    The language of the document is contained in a field of the header table
    {MyMarketingDocTable.LanguageID}
    I created a user table named "MyTranslationTable" where I added some strings in different langiages.
    For example:
    TexiID            TextString              LangID
    T00001          Delivery                          8      
    T00001          Consegna                     13       (Italian translation)
    T00002          Invoice                           8
    T00002          Fattura                         13       (Italian translation)
    In the header of the report I'd like, for example, to visualise the string "Consegna" if my document is a delivery in italian language.
    I'd like to implement this method to translate all the textboxes (header, comments, etc.) based on the languageID of my document.
    For each textboxes, in the CR designer statically I know what TextID I want to visualized but dinamically I need to pass to my stored procedure the right language. I'd like my report automatically gets the language at run-time. I don't want that when I press the Print-preview button in SAP B1, the report asks to prompt the languageID.
    It already read the DocNum and DocType and it already filter the SAP B1 tables basing on the DocNum and DocType of the document. In this way it reads the right row in the SAP B1 table and in this way I can read all the fields of this row (also the languageID of the actual document).
    Regards
        Emanuele
    Edited by: Emanuele Croci on Dec 3, 2010 9:03 AM

  • Parameters to stored procedure from sender JDBC

    Hi,
    I am using the JDBC sender adapter to call the Oracle stored procedure. Oracle version is 10.2. hence I m using function call using select.
    My concern is, how to pass the input parameter to Oracle function from JDBC sender.
    Regards,
    Kavita

    Hi Kavita,
    <i>I am using the JDBC sender adapter to call the Oracle stored procedure</i>
    <i>Unfortunately, the sender JDBC adapter does not support Oracle's stored procedure/function. Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset. The sender JDBC adapter must send a resultset to XI.</i>
    Executing an Oracle Stored Procedure from Sender JDBC adapter
    [Not sure about latest versions of Oracle]
    <i>can I pass the input parameter to this function? </i>
    In my opinion, No
    <i>If not, I need to change the approach, and need to use receiver JDBC[as need to pass input parameter]. </i>
    This could be possible but havent tried it
    <i>Can JDBC Receiver adapter support stored procedure for Oracle[10.2]</i>
    Yes
    Regards,
    Prateek

Maybe you are looking for

  • Schedule lines should not be maintained with out release

    schedule lines should not be maintained with out release of schedule agreement......but system accepting to maintain the schedule lines.Please say how. regards, Sridhar kumar.a

  • Crash report Monotype SkyFonts

    Hello, installed program crashes with report. My other mac same application runs without problems. What could be the problem? Process:         Monotype_SkyFonts [639] Path:            /Applications/Monotype SkyFonts.app/Contents/MacOS/Monotype_SkyFon

  • Column values separated by ,

    Suppose say I have table TAB1 with the following data : COL1 COL2 1 A 1 B 1 C 2 M 2 N 2 O 2 P 2 Q 3 S 3 T How would I retrieve the data in the following format ? 1 A,B,C 2 M,N,O,P,Q 3 S,T

  • The labview 7.1 can programing for fpga?

    The labview 7.1 can programing for fpga our I need buy the labview 8 fpga? How much the software labview 8 and the fpga targets?

  • Where is skype setting will be found in phone

    I cant find my setting in my phone Ill trying to turn off the contact syc in my phone book and im going too add my friends manually