Database package (stored procedure) seems to be hanging

Hi,
Our application seems to be hanging after executing a database package repeatedly. It happens after 5-10 invocations of the same package in a loop. Any ideas why this happens?
Thanks in advance,

Narayana,
Your really going to have to give more detail than "it hangs and we don't know why". I always use a program called TOP SESSIONS in OEM to monitor a running process. It's a good place to start. If you don't have that query v$session and find the session that is running that package. Normally good coders have trace tables they write debug into (with a debug flag on every proc), so that when you run a procedure/function/package it begins recording that it's doing so you can monitor it's process. It sound like you don't have any kind of tracing going on so you have no idea what's happening. Even use DBMS_OUTPUT.PUT_LINE to show where it is at in the code.
Also in regards to that top sessions program (OEM 1.6), there is one called lock manager. The newer OEM might have this I don't know, I don't use it. But the initial process your running might be opening locks and keeping them open, thus other packages fire and are still waiting for the first one to let go. Are you killing the first session BEFORE firing off the next?
Try and get some monitoring tools, many are free to download like Oracle's OEM, so you can monitor what's going on. However but you really need to record some kind of trace in your code so when it runs you can see what step it is at when it does hang. Also check for TRACE files that progress might be making and the alert log as well (both on the server's operating system).
Hope this helps a little.
Tyler D.

Similar Messages

  • Pass BLOB as parameter to Packaged Stored Procedure

    Does JDBC (thin or otherwise) support passing a BLOB as a parameter to a packaged stored procedure in Oracle, or do we have to do an 'insert' statement to get it in?
    All the articles I've seen seem to refer to insert and select, but I want to strictly enforce all access to the database being through a package rather than table level access.
    We've certainly had no difficulty receiving blobs from the resultset returned by our packaged procedures.
    Any help appreciated,
    Thanks
    Jason.

    C5112736 wrote:>
    > And then these 2 formulas 'Formula # 1' and 'Formula # 2' can be used to pass on to the stored procedure.
    Can someone please demonstrate exactly how to use formula results as date parameters to a SQL stored procedure?  Keep in mind, there are two parameters to the stored procedure.
    I have gleaned this much: Use Add Command and insert the procedure with
    EXEC ServerName.dbo.usp_sprocName;1 '{?StringParameter}'
    but if I try to do
    {CALL ServerName.dbo.usp_SprocName({@Formula1},{@Formula2})}
    then it gives the error "No value given for one or more required parameters". 
    Both of the parameters are VARCHAR(50).
    I have finally found this link: [http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx|http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx]
    This Microsoft site defines the format of the ODBC escape sequences, but I still do not know how to convince Crystal to insert it's parameter results or formula results.
    Pulling what's left of my hair out . . .
    ~ Shaun

  • Strange download size of on calling packaged stored procedure in VB6

    Hi,
    I tried to use VB6 to call oracle stored procedure with ref cursor as output parameter under a package in 10g database (10.1.03). Oracle client uses windows 9.2 / 10.1.02 (Oracle OLEDB Provider) . I found that when the package size increases(> 1000 lines codes), the data size transfer from database to VB client also increases. I try to trap the binary data flow between VB6 and database when calling packaged stored procedure. I found that VB6(or oracle client ??) will first download package spec then execute the requested stored procedure. This may explain the cause of increasing size.
    However, this large download size for calling only one of the procedure will make my application run slowly when my application uses the package much. How can I solve this problem ? Does this relate to oracle client(p.s. this problem disappear when using Microsoft OLEDB Provider)?
    Thanks
    Steven

    You can use a wrapper to get compiled code and if it's 10g you can do even more by putting it in a library.
    OLEDB from VB6 still using Oracle 'Client' as you call Oracle NET.

  • Sending Long Raw Data to Oracle database through Stored  Procedure

    Hi,
    I am trying to push data to Oracle 9i database through Stored Procedure via thin driver. It is going smoothly upto 29411 bytes. But it is not accepting for 53843 bytes and giving following error :
    java.sql.SQLException: Data size bigger than max size for this type: 53843
    Is it thin driver limitation? Can I solve it by using OCI driver? Or is there any other approach?
    I tried creating connection pool in weblogic 7.0 through OCI driver. But I am not able to configure it. Is there any special way of configuration.
    Quick response will be greatly appreciated.
    Thanks
    Sanjiv

    It happens to me. But I am using CMP of Weblogic 7. If you write your own jdbc code, the following link may be helpful.
    http://otn.oracle.com/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html

  • Could I export and import my oracle database via Stored Procedure???

    Hi all,
    I need to export my database using stored procedure, the stored procedure will be called by java application and it works well
    Now I still get the "BIG QUESTION", could I export and import database using stored procedure???
    Really thanks for the response.
    Regards,
    Kahlil

    Hi,
    I think you can use DBMS_DATAPUMP (10.1+), see [DBMS_DATAPUMP|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples see [http://www.psoug.org/reference/dbms_datapump.html]
    Regards,

  • Open other database in stored procedure

    Hi All,
    Im going to open other database in stored procedure.
    Can anyone help me? Thanks

    You cannot open or connect in plsql procedure, but can use database link.
    Documents:
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#ADMIN029
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#i2061505
    Message was edited by:
    ushitaki

  • Calling packaged stored procedure from php fails

    The following php fails with:-
    Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SPMEMBERDETAILS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in C:\Program Files\Apache Group\Apache2\htdocs\KioskCurrent\GM2.php on line 28
    Cannot Execute statement
    <?php
    $number = "2100418933";
    // Connect to database...
    $conn=OCILogon("big", "big");
    if ( ! $conn ) {
    echo "Unable to connect: " . var_dump( OCIError() );
    die();
    $cursor = OCINewCursor($conn);
    $stmt = OCIParse($conn, "BEGIN spPackage.spMemberDetails(:number, :cv_memberdetails); END;")
    or die('Cannot parse query');
    OCIBindByName($stmt, ":cv_memberdetails", &$cursor)
    or die('Cannot bind array variable');
    OCIBindByName($stmt, ":number", &$number)
    or die('Cannot bind number variable');
    $exec = OCIExecute($stmt)
    or die('Cannot Execute statement');
    OCIExecute($cursor);
    while ($data = OCIFetchInto($cursor)) {
    var_dump($data);
    OCIFreeStatement($stmt);
    OCIFreeCursor($cursor);
    OCILogoff($conn);
    ?>
    and the stored procedure looks like
    SQL> desc sppackage;
    PROCEDURE SPGETMEMBERNUMBER
    Argument Name Type In/Out Default?
    P_NUMBER VARCHAR2 IN
    P_MEMBERNUMBER VARCHAR2 OUT
    PROCEDURE SPGETSLOTSHANDLE
    Argument Name Type In/Out Default?
    P_HANDLE NUMBER(15,2) OUT
    P_NUMBER VARCHAR2 IN
    P_STARTDATE VARCHAR2 IN
    P_ENDDATE VARCHAR2 IN
    PROCEDURE SPGETTABLEHANDLE
    Argument Name Type In/Out Default?
    P_HANDLE NUMBER(15,2) OUT
    P_NUMBER VARCHAR2 IN
    P_TABLEGAMEPREFIX VARCHAR2 IN
    P_STARTDATE VARCHAR2 IN
    P_ENDDATE VARCHAR2 IN
    PROCEDURE SPMEMBERDETAILS
    Argument Name Type In/Out Default?
    P_NUMBER VARCHAR2 IN
    CV_MEMBERDETAILS REF CURSOR OUT
    RECORD OUT
    R_MEM_NUMBER VARCHAR2(12) OUT
    R_MEM_SNAME VARCHAR2(25) OUT
    R_MEM_FNAME VARCHAR2(25) OUT
    R_MEM_TITLE VARCHAR2(25) OUT
    PROCEDURE SPTABLESPLAYED
    Argument Name Type In/Out Default?
    P_NUMBER VARCHAR2 IN
    P_STARTDATE VARCHAR2 IN
    P_ENDDATE VARCHAR2 IN
    CV_TABLESPLAYED REF CURSOR OUT
    RECORD OUT
    Please tell me what I have done incorrect.

    I would guess it is something to do with not binding all the OUT variables, it seems you have only binded the OUT cursor? For more details calling Stored Procedures see
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_sps.html

  • Calling packaged stored procedure from Java

    Hi All,
    I'm trying to call a stored procedure from Java but I'm having
    problems with registrating the output parameter. I'm getting
    the error: Conflicting parameters.: sqltype=2003
    This is the stored procedure which is located in a package in
    the Oracle database:
    package Pack_GetAgencyInformation as
    Type InfoType is record ( agen_code varchar(3), agen_designation
    varchar(30), agen_adresse varchar(60), agen_tel varchar(12) );
    function GetAgencyInformation( P_AGENCE VARCHAR )
    return Pack_GetAgencyInformation.InfoType
    end Pack_GetAgencyInformation;
    This is the Java source from where I'm calling the procedure:
    //DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
         Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@164.48.69.125:1521:ventes", "system", "*****
    // @machineName:port:SID,
    userid, password
    CallableStatement cs = conn.prepareCall("{ ? = call
    Pack_GetAgencyInformation.GetAgencyInformation( ? )}");
         try {
              cs.registerOutParameter( 1,
    oracle.jdbc.driver.OracleTypes.ARRAY);
         } catch (SQLException e) {
              e.printStackTrace();
         cs.setString(2, "001" );
         //ResultSet rset = cs.executeQuery();
    The stacktrace:
    java.sql.SQLException: Parametertypen conflicteren.:
    sqlType=2003
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:210)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:220)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:350)
    at dbAccess.main(dbAccess.java:25)
    I think it has to do with the type InfoType which is created in
    the Stored Procedure. I'm absolute no Oracle expert and I
    prefer not to make changes to the Oracle database. So any
    solution in Java is welcome!
    BR, H.Rietman

    I managed to get it to work only by changing the stored
    procedure. I have changed the return type record to a Ref
    Cursor type (had to change alot of code for this). It seams
    that Oracle JDBC drivers DON'T support the Record type as a
    return type.
    So the next question is: is it possible to typecast a record
    type to a ref cursor type in Oracle. In this way I can easily
    change the return type for the stored procedures.
    /Harald

  • Is BC4J a viabl option for database with stored procedure (ref cursor) API?

    I'm about to begin a Web application development project. As foundation, we have a (Oracle) database of certain complexity that have a data access API developed with PL/SQL packages.
    This API is designed to get data through stored procedures/functions that return REF CURSOR.
    Personally I have been investigating about Oracle ADF/JSF, and a number of others J2EE technologies, and at this moment I am doubting if ADF BC are a viable option to my development team.
    I think this because I have noticed that one of the great drawback in ADF BC is the lack of simplicity to get data through stored procedures/functions that returns REF CURSORS.
    I have been looking for documentation and the only thing that I have found are two examples:
    1.- One that really do not work (fails in get data from ref cursor): ADF BC StoredProcedure Sample application.
    2.- And other published by Steve Muench in
    http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html. This sample works fine.
    But, the problem with the approach of this last article is the amount (and complexity) of the code necessary to make so basic and recurrent operation as is "obtain data through a stored procedure (ref cursor)".
    Below it is the code that I have constructed to call a function that returns a ref cursor (based on steve's article).
    If this is the only way to make this (historically so basic and simple) task, then it is obvious that BC is not a viable technology to my (or I am in a mistake?), since we have about 50 stored procedures/functions to access the underlying data; that stored procedures/functions are key to development of the new application (and, still more, currently are used to anothers apps ).
    By all this, I would like consult to Oracle's people:
    1.- I really must reject BC as technology to implement this project ?
    2.- It is possible to access stored procedures in a simpler way using BC?
    3.- If the answer to 2 is NOT: in near future, the BC team has plans to give more support to the simple access to stored procedures?
    4.- If the answer to 3 is NOT: what another technology you recommend to construct my data access/business tier and still be able to using the others characteristics of ADF?
    Thank you very much for your guidelines.
    Regards, RL.
    ** And the code!!!
    ** ###   I am forced to do this for each call to a procedure???? ###
    package myrefcursor.model;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.NullValue;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    public class TraePolizasViewImpl extends ViewObjectImpl {
        private static final String SQL = "begin ? := PKG_PRUEBA.trae_polizas(?);end;";
        private static final String COUNTSQL = "begin ? := PKG_PRUEBA.count_trae_polizas(?);end;";
        public TraePolizasViewImpl() {
        protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
            BigDecimal rut_contratante = null;
            Object[] theUserParam = null;
            System.out.println(params);
            System.out.println(params[0]);
            if (params != null)
                theUserParam = (Object[]) params[0];
            //if (theUserParam != null && theUserParam.length > 0 )
            if (! (theUserParam[1]   instanceof NullValue) )
                rut_contratante = (BigDecimal)theUserParam[1];
            storeNewResultSet(qc ,retrieveRefCursor(qc, rut_contratante));
            super.executeQueryForCollection(qc, params, numUserParams);
        protected void create() {
          getViewDef().setQuery(null);
          getViewDef().setSelectClause(null);
          setQuery(null);
        protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
          rs = getResultSet(qc);
          ViewRowImpl r = createNewRowForCollection(qc);
          try {
            populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
            populateAttributeForRow(r,1, rs.getString(2));
          catch (SQLException s) {
           throw new JboException(s);
          return r;
        protected boolean hasNextForCollection(Object qc) {
          ResultSet rs = getResultSet(qc);
          boolean nextOne = false;
          try {
            nextOne = rs.next();
            if (!nextOne) {
              setFetchCompleteForCollection(qc, true);
              rs.close();
          catch (SQLException s) {
           throw new JboException(s);
          return nextOne;
        protected void releaseUserDataForCollection(Object qc, Object rs) {
           ResultSet userDataRS = getResultSet(qc);
           if (userDataRS != null) {
            try {    userDataRS.close();    }
            catch (SQLException s) { ; }  
          super.releaseUserDataForCollection(qc, rs);
        public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
          return viewRowSet.getRowCount();
        private ResultSet retrieveRefCursor(Object qc, BigDecimal rut_contratante) {
          CallableStatement st = null;
          try {
            st = getDBTransaction().createCallableStatement(SQL, DBTransaction.DEFAULT);
            st.registerOutParameter(1,OracleTypes.CURSOR);
            if (rut_contratante == null)
                st.setNull(2, Types.NUMERIC);
            else
                st.setBigDecimal(2, rut_contratante);
            st.execute();
            ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
            rs.setFetchSize(getFetchSize());
            return rs ;
          catch (SQLException s) {
            throw new JboException(s);
          finally {try {st.close();} catch (SQLException s) {;}}
        private void storeNewResultSet(Object qc, ResultSet rs) {
          ResultSet existingRs = getResultSet(qc);
          if (existingRs != null) {
            try {existingRs.close();} catch (SQLException s) {;}  
          setUserDataForCollection(qc,rs);
          hasNextForCollection(qc); // Prime the pump with the first row.
        private ResultSet getResultSet(Object qc) {
            return (ResultSet)getUserDataForCollection(qc);
        private static Number nullOrNewNumber(BigDecimal b) {
             try {
               return b != null ? new Number(b) : null;
             catch (SQLException s) { ; }
             return null;
        public BigDecimal getprutcontratante() {
            return (BigDecimal)getNamedWhereClauseParam("prutcontratante");
        public void setprutcontratante(BigDecimal value) {
            setNamedWhereClauseParam("prutcontratante", value);
    }

    no?

  • Web form not updating database with stored procedure

    Hello
    i have a problem with the web form updating the database i have a stored procedure which i need to connect to. If i execute the procedure in the SQL it will update the database but when i run the web form i get my catch error "could not update database".
    I have read so much on the net and my code seem ok but i,m just so lost.
    stored procedure
    PROCEDURE [dbo].[UpdateCustomer]
    @ID INT,
    @Firstname VARCHAR(30),
    @Surname VARCHAR(30),
    @Age INT
    AS
    BEGIN
    UPDATE Customer
    SET Firstname = @Firstname,
    Surname = @Surname,
    Age = @Age
    WHERE CustID = @ID
    END
    update code
    try
    SqlCommand command = new SqlCommand();
    command.Connection = conn;
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = "UpdateCustomer";
    command.Connection.Open();
    SqlParameter param = new SqlParameter();
    param.ParameterName = "@ID";
    param.SqlDbType = SqlDbType.Int;
    param.Direction = ParameterDirection.Input;
    param.Value = txtCustID.Text;
    command.Parameters.Add(param);
    command.Parameters.AddWithValue("@CustID", txtCustID.Text.ToString());
    command.Parameters.AddWithValue("@Firstname", txtFirstname.Text);
    command.Parameters.AddWithValue("@Surname", txtSurname.Text);
    command.Parameters.AddWithValue("@Gender", Gender.Text.ToString());
    command.Parameters.AddWithValue("@Age" ,txtAge.Text.ToString());
    command.Parameters.AddWithValue("@Address1", txtAddress1.Text.ToString());
    command.Parameters.AddWithValue("@Address2", txtAddress2.Text.ToString());
    command.Parameters.AddWithValue("@City", txtCity.Text.ToString());
    command.Parameters.AddWithValue("@Phone", txtPhone.Text.ToString());
    command.Parameters.AddWithValue("@Mobile", txtMobile.Text.ToString());
    command.Parameters.AddWithValue("@Email", txtEmail.Text.ToString());
    command.ExecuteNonQuery();
    lblMessage.Text = "Your Record(s) Have been Updated";
    command.Connection.Close();
    catch
    lblMessage.Text = "Your Record was not updated please try again";
    Thank you for your help

    To expand on Mike's advice.
    Change your catch to:
    catch(Exception ex)
    { // Break point here
    lblMessage.Text = "Your Record was not updated please try again";
    Put a break point in where the comment says.
    Run it.
    Hover over ex or add a quickwatch ( right click it ) and see what the error and inner exception is.
    I see several problems though.
    You have way too many parameters and Age should be int.
    They are objects  - they have a type.
    It'll be a string with your code there.
    Something more like
    command.Parameters.Add("@Age", SqlDbType.Int);
    command.Parameters["@Age"].Value = Convert.ToInt32(txtAge.Text);
    Although that might not cut and paste, it's air code intended to give you the idea.
    Hope that helps.
    Technet articles: Uneventful MVVM;
    All my Technet Articles

  • Oracle Packaged Stored Procedure

    I am failing in an attempt to access an Oracle database using the following php.
    The calls I have tested are as follows:-
    $query = "begin spPackage.spMemberDetails(:p_number,:cv_memberdetails); end;";
    $stmt = OCIParse($conn, $query )
    or die('Cannot parse query');
    OCIBindByName($stmt,":p_number",$number, -1)
    or die('First cannot bind variable');
    OCIBindByName($stmt, ":cv_memberdetails", &$array, -1)
    or die('Second cannot bind variable');
    OR
    $query = "begin spPackage.spMemberDetails(:p_number); end;";
    $stmt = OCIParse($conn, $query )
    or die('Cannot parse query');
    OCIBindByName($stmt,":p_number",$number, -1)
    or die('First cannot bind variable');
    I get the following error message:-
    ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SPMEMBERDETAILS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    begin spPackage.spMemberDetails(:p_number); end;
    ^
    The 1st part of the stored procedure I am trying to use is as follows:-
    CREATE OR REPLACE PACKAGE "BIG"."SPPACKAGE" AS
    type memberdetail_type is record (
    r_mem_number members.mem_number%type,
    r_mem_sname members.mem_sname%type,
    r_mem_fname members.mem_fname%type,
    r_mem_title members.mem_title%type);
    type memberdetail_cur_type is ref cursor return memberdetail_type;
    PROCEDURE spMemberDetails(
    p_number cards.card_number%type, --varchar2                                 
    cv_memberdetails out memberdetail_cur_type);
    Please tell me what I am not understanding and where I have gone wrong.
    BTW I did not write the stored procedure.
    Message was edited by:
    user446320

    See Re: Calling stored procedure from php script.
    -- CJ

  • How to find Packaged Stored Procedure?

    Hi,
    Is there any API routine to find out if a particular StoredProcedure belongs to a package or not?? Or in the other way around , can i get to know about a list of Stored procedures a particular database package has?
    ( P.S :- getProcedures method in DatabaseMetadata gives just a list of all Standalone and Packaged procedures as one list. )
    Narendran.

    Hi,
    I have the same problem to call a stored Procedure in a Package.
    If my procedure is not in a package, everything is right.
    And I musn't indicate all the name, because I musn't put '.' in the name (of the procedure), in my DT on XI.
    It would be so nice to have an answer.
    Rémi

  • How to call Packaged Stored Procedure in JDBC Adapter?

    hello frnds,
    I m working on a SAP R/3 -> XI -> Oracle scenario. Here on receiver side i m using JDBC Adapter in which i m using a stored procedure.
    I have my stored procedure in a Package. Example : package "PKG_SPARES_VOR_UPLOAD" and in that stored procedure "pr_spares_vor_po_hdr_upload".
    i have checked that if i write this stored procedure outside the package then it works fine... but if i put it into the package then it is giving me error that ....
    " Receiver Adapter v2112 for Party '', Service 'BS_ORADEV':
    Configured at 2006-08-16 10:12:14 GMT+05:30
    History:
    - 2006-08-16 11:02:04 GMT+05:30: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'PR_SPARES_VOR_PO_HDR_UPLOAD' (structure 'statement'): java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00201: identifier 'PR_SPARES_VOR_PO_HDR_UPLOAD' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored ".
    please help me out with this problem.
    Thankx,
    Regards,
    Audumbar

    Hi,
    I have the same problem to call a stored Procedure in a Package.
    If my procedure is not in a package, everything is right.
    And I musn't indicate all the name, because I musn't put '.' in the name (of the procedure), in my DT on XI.
    It would be so nice to have an answer.
    Rémi

  • How can I transfer a XML file content to a MS SQL database by stored procedure using LabWindows/CVI SQL Toolkit?

    Hi,
    I have a problem to transfer a XML file content to a MS SQL database by a given/fixed stored procedure. I'm able to transfer the content of the file by using following method ...
    hstmt = DBPrepareSQL (hdbc, EXEC usp_InsertReport '<Report> ..... </Report>');
    resCode = DBExecutePreparedSQL (hstmt);
    resCode = DBClosePreparedSQL (hstmt);
    ... but in this case I'm not able to fetch the return value of the stored procedure! 
    I have tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL) but I miss a datatype for xml?!?
    Any idea how to solve my problem?
    KR Cake  
    Solved!
    Go to Solution.

    After some additional trials I found a solution by calling the stored procedure in this way
    DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
    DBPrepareSQL (hdbc, "usp_InsertReport");
    DBCreateParamInt (hstmt, "", DB_PARAM_RETURN_VALUE, -1);
    DBCreateParamChar (hstmt, "XMLCONTENT", DB_PARAM_INPUT, sz_Buffer, (int) strlen(sz_Buffer) + 1 );
    DBExecutePreparedSQL (hstmt);
    DBClosePreparedSQL (hstmt);
    DBGetParamInt (hstmt, 1, &s32_TestId);
    where sz_Buffer is my xml file content and s32_TestID the return value of the stored procdure (usp_InsertReport(@XMLCONTENT XML))
    Now I face the problem, that DBCreateParamChar limits the buffer size to 8000 Bytes.
    Any idea to by-pass this shortage??

  • Read XML file into databased using stored procedure

    I need to read an xml file into my database using a stored procedure. I looked at a couple of tutorials, but I am kind of lost and am looking for some guidance. I will eventually need to only pull a handfull of the data in based on the USER ID. Any help will be greatly appreciated. I have been given a schema file and an example file of how the data will me sent to me. The schema file is below:
    <h1>Schema File</h1>
    <?xml version="1.0" encoding="utf-8"?>
    <!--Generated by Turbo XML 2.4.1.100. Conforms to w3c http://www.w3.org/2001/XMLSchema-->
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xsd:element name="root">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="Report">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="Biller" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Biller">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="BillerName" />
    <xsd:element ref="BillerIdNumber" />
    <xsd:element ref="PartnerInfo" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="BillerName">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="BillerIdNumber">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PartnerInfo">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="PartnerName" />
    <xsd:element ref="PartnerVenderNumber" />
    <xsd:element ref="PartnerStreet01" />
    <xsd:element ref="PartnerStreet02" />
    <xsd:element ref="PartnerCity" />
    <xsd:element ref="PartnerState" />
    <xsd:element ref="PartnerZip" />
    <xsd:element ref="PartnerCountry" />
    <xsd:element ref="PartnerActive" />
    <xsd:element ref="PartnerContactName" />
    <xsd:element ref="PartnerEmailAddress" />
    <xsd:element ref="PartnerContactPhone" />
    <xsd:element ref="PartnerFaxNumber" />
    <xsd:element ref="PartnerUpdateUser" />
    <xsd:element ref="PartnerUpdateDate" />
    <xsd:element ref="PartnerDocColor" />
    <xsd:element ref="PartnerDocDistribution" />
    <xsd:element ref="PartnerDocPrinting" />
    <xsd:element ref="PartnerDocTiming" />
    <xsd:element ref="Delivery" maxOccurs="unbounded" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PartnerName">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PartnerVenderNumber">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PartnerStreet01">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerStreet02">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerCity">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerState">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerZip">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerCountry">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerActive">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerContactName">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerEmailAddress">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerContactPhone">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerFaxNumber">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerUpdateUser">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerUpdateDate">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerDocColor">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerDocDistribution">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerDocPrinting">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="PartnerDocTiming">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="Delivery">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="DeliveryType" />
    <xsd:element ref="DeliveryContactName" />
    <xsd:choice>
    <xsd:element ref="ReceivingStreet01" />
    <xsd:element ref="ReceivingStreet02" />
    <xsd:element ref="ReceivingCity" />
    <xsd:element ref="ReceivingState" />
    <xsd:element ref="ReceivingZip" />
    <xsd:element ref="ReceivingCountry" />
    <xsd:element ref="DeliveryEmailAddress" />
    <xsd:element ref="DeliveryCompanyId" />
    <xsd:element ref="DeliveryUserId" />
    <xsd:element ref="DeliveryFormatType" />
    <xsd:element ref="SecureType" />
    <xsd:element ref="SecureQuestion" />
    <xsd:element ref="SecureAnswer" />
    <xsd:element ref="DeliveryFaxNumber" />
    </xsd:choice>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryType">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryContactName">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryEmailAddress">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="SecureType">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="SecureQuestion">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="SecureAnswer">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryFormatType">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryCompanyId">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryUserId">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="DeliveryFaxNumber">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="ReceivingStreet01">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="ReceivingStreet02">
    <xsd:complexType />
    </xsd:element>
    <xsd:element name="ReceivingCity">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="ReceivingState">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="ReceivingZip">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="ReceivingCountry">
    <xsd:complexType mixed="true">
    <xsd:choice />
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    <h1>Example File</h1>
    <?xml version="1.0" encoding="utf-8"?>
    <Report>
    <Biller>
    <BillerName>DONATO TEST BILLER</BillerName>
    <BillerIdNumber>999999999</BillerIdNumber>
    <PartnerInfo>
    <PartnerName>TEST TRADING PARTNER</PartnerName>
    <PartnerVenderNumber>999999999</PartnerVenderNumber>
    <PartnerStreet01 />
    <PartnerStreet02 />
    <PartnerCity />
    <PartnerState />
    <PartnerZip />
    <PartnerCountry />
    <PartnerActive />
    <PartnerContactName />
    <PartnerEmailAddress />
    <PartnerContactPhone />
    <PartnerFaxNumber />
    <PartnerUpdateUser />
    <PartnerUpdateDate />
    <PartnerDocColor />
    <PartnerDocDistribution />
    <PartnerDocPrinting />
    <PartnerDocTiming />
    <Delivery>
    <DeliveryType>EMAIL</DeliveryType>
    <DeliveryContactName>Kiran</DeliveryContactName>
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    </Delivery>
    <Delivery>
    <DeliveryType>SECURE</DeliveryType>
    <DeliveryContactName />
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    <SecureType />
    <SecureQuestion>Pet Name</SecureQuestion>
    <SecureAnswer>040698de9bf14ef87d8cbaf46b8ecddc</SecureAnswer>
    <DeliveryFormatType />
    </Delivery>
    <Delivery>
    <DeliveryType>CEO</DeliveryType>
    <DeliveryContactName />
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    <DeliveryCompanyId>WFADM618</DeliveryCompanyId>
    <DeliveryUserId>PAULSEN</DeliveryUserId>
    <DeliveryFormatType />
    </Delivery>
    <Delivery>
    <DeliveryType>FAX</DeliveryType>
    <DeliveryContactName>Kiran</DeliveryContactName>
    <DeliveryFaxNumber>4807244340</DeliveryFaxNumber>
    <DeliveryFormatType>PDF</DeliveryFormatType>
    </Delivery>
    <Delivery>
    <DeliveryType>DOC</DeliveryType>
    <DeliveryContactName />
    <ReceivingStreet01>2600 South Price Road</ReceivingStreet01>
    <ReceivingStreet02 />
    <ReceivingCity>Chandler</ReceivingCity>
    <ReceivingState>AZ</ReceivingState>
    <ReceivingZip>85248</ReceivingZip>
    <ReceivingCountry>United States</ReceivingCountry>
    </Delivery>
    <Delivery>
    <DeliveryType>DR</DeliveryType>
    <DeliveryContactName />
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    <DeliveryCompanyId>WFADM618</DeliveryCompanyId>
    <DeliveryUserId>PAULSEN</DeliveryUserId>
    <DeliveryFormatType />
    </Delivery>
    </PartnerInfo>
    </Biller>
    </Report>

    Try with a XMLTABLE function
    For example to Extract BillerName and BillerID
    with t as(select xmltype( '<?xml version="1.0" encoding="utf-8"?>
    <Report>
    <Biller>
    <BillerName>DONATO TEST BILLER</BillerName>
    <BillerIdNumber>999999999</BillerIdNumber>
    <PartnerInfo>
    <PartnerName>TEST TRADING PARTNER</PartnerName>
    <PartnerVenderNumber>999999999</PartnerVenderNumber>
    <PartnerStreet01 />
    <PartnerStreet02 />
    <PartnerCity />
    <PartnerState />
    <PartnerZip />
    <PartnerCountry />
    <PartnerActive />
    <PartnerContactName />
    <PartnerEmailAddress />
    <PartnerContactPhone />
    <PartnerFaxNumber />
    <PartnerUpdateUser />
    <PartnerUpdateDate />
    <PartnerDocColor />
    <PartnerDocDistribution />
    <PartnerDocPrinting />
    <PartnerDocTiming />
    <Delivery>
    <DeliveryType>EMAIL</DeliveryType>
    <DeliveryContactName>Kiran</DeliveryContactName>
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    </Delivery>
    <Delivery>
    <DeliveryType>SECURE</DeliveryType>
    <DeliveryContactName />
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    <SecureType />
    <SecureQuestion>Pet Name</SecureQuestion>
    <SecureAnswer>040698de9bf14ef87d8cbaf46b8ecddc</SecureAnswer>
    <DeliveryFormatType />
    </Delivery>
    <Delivery>
    <DeliveryType>CEO</DeliveryType>
    <DeliveryContactName />
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    <DeliveryCompanyId>WFADM618</DeliveryCompanyId>
    <DeliveryUserId>PAULSEN</DeliveryUserId>
    <DeliveryFormatType />
    </Delivery>
    <Delivery>
    <DeliveryType>FAX</DeliveryType>
    <DeliveryContactName>Kiran</DeliveryContactName>
    <DeliveryFaxNumber>4807244340</DeliveryFaxNumber>
    <DeliveryFormatType>PDF</DeliveryFormatType>
    </Delivery>
    <Delivery>
    <DeliveryType>DOC</DeliveryType>
    <DeliveryContactName />
    <ReceivingStreet01>2600 South Price Road</ReceivingStreet01>
    <ReceivingStreet02 />
    <ReceivingCity>Chandler</ReceivingCity>
    <ReceivingState>AZ</ReceivingState>
    <ReceivingZip>85248</ReceivingZip>
    <ReceivingCountry>United States</ReceivingCountry>
    </Delivery>
    <Delivery>
    <DeliveryType>DR</DeliveryType>
    <DeliveryContactName />
    <DeliveryEmailAddress>[email protected]</DeliveryEmailAddress>
    <DeliveryCompanyId>WFADM618</DeliveryCompanyId>
    <DeliveryUserId>PAULSEN</DeliveryUserId>
    <DeliveryFormatType />
    </Delivery>
    </PartnerInfo>
    </Biller>
    </Report>')xml from dual)
    select q.* from t,xmltable('/Report' passing t.xml columns
    BillerName varchar2(20) PATH
                          '/Report//Biller/BillerName')q
            BILLERNAME     BILLERID
         DONATO TEST BILLER     999999999

Maybe you are looking for

  • Consuming MapPoint Web Service with MX7

    Can anyone offer any pointers for working with Microsoft's MapPoint web service? I've searched around but haven't found any usable information. My immediate concern is how to get my CF7 application to perform the Digest Authentication, but I'd also w

  • Error occured while accessing WebDynpro Application

    Hi, I am getting below mentioned error when i am trying to access WebDynpro application through Portal. Appropriate roles have been assigned to me in Portal as well Dynpro. What is the cause of this error message ? Is this something to do with Author

  • SCREEN ENABLE AND DISABLE

    Hi,    I have a selction screen as below, parameter :  r_c1 RADIOBUTTON GROUP id1 DEFAULT 'X'. parameter :  p_fpath1 TYPE rlgrap-filename. parameter :  r_c2 RADIOBUTTON GROUP id1 DEFAULT 'X'. parameter :  p_fpath2 TYPE rlgrap-filename. parameter :  r

  • Components of SGA?

    I'm aware of 1) sga_max_size should be >= Total SGA. 2) Size of the Total SGA = (shared_pool_size+large_pool_size+java_pool_size+db_keep_cache_size+db_recycle_cache_size+db_2k_cache_size+db_4k_cache_size+db_8k_cache_size+db_16k_cache_size+db_32k_cach

  • Configuring New Oracle Database with HFM Shared Services

    Hi, We have upgrated the oracle database to new version 11g. We are using HFM 11.1.1.3 version. When I tried to configure the new oracle database with existing HFM Shared Services, the EPM Configurator hangs. Please could you clarify the below few qu