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

Similar Messages

  • 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,

  • 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

  • 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

  • Why two different users from same login group not able to access the database object(stored procedure)?

    I have SQL login group as "SC_NT\group_name" in server. There are multiple users using this login group to access database objects. User "A" can able to access db object(stored_procedure_1) from .net application. But when user "B"
    tried to access same db object(stored_procedure_1), its showing like
    Error: The EXECUTE permission was denied on the object 'stored_procedure_1', database 'test',schema 'dbo'. 
    Both the users are using windows authentication for access the objects. Could you suggest me the way to resolve this?
    Venkat

    Thanks for your response
    Erland Sommarskog....
    my stored procedure "stored_procedure_1"
    does not has any granted permissions to execute. But still user A
    able to execute the sp from UI, where user B not able to do it.  If any permission provided for a particular object, then only it will display in the above query whatever u have given.  
    Any other possibilities??
    Venkat G

  • 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?

  • Database toolkit stored procedure return String

    Hi all,
    How I can return the entire string from my stored procedure using the attached code ?
    With this code I only retrive the first caractere of the string return by the stored procedure.
    Thanks for your help.
    MHP

    It could be that there is something screwy with LV, but given that it uses standard interfaces for comm with the DBMS, I would not expect that. A much more realistic possibility is that the toolkit is mucking things up. (A fairly common occurrence.)
    Try bypassing the toolbox -- which you don't really need anyway -- an talk directly to the ActiveX or .net interface.
    Also, what DBMS? What drivers are you using?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Question: how to open a database diagram stored in subversion

    I am new to Jdeveloper and am exploring Jdeveloper 11g TP4 interaction with subversion.
    I created a project and then created a database diagram and added it to subversion.
    On another computer that does not have the same project defined, I would like to access and open the database diagram. I can select the diagram in Subversion Navigator. The database diagram editor does not launch when I choose open from the context menu. Should it?
    I am not grokking something and would appreciate any tips.

    atlr,
    You cannot open the diagram directly from Subversion like that. You need to check out a copy in order to open it.
    Hope this helps,
    John

  • 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.

  • Database toolkit - stored procedure doesn't work in labview

    Hello,
    I have written simple procedure that works good when I run it from workbench but doesn't work from labview. I want to insert some data and get primary key of inserted id:
    CREATE DEFINER=`root`@`localhost` PROCEDURE `new_procedure`(
    IN emp_id_val int,
    IN project_id_val int,
    IN work_mode_val int)
    BEGIN
    insert into work_managment.sessions (emp_id,project_id,work_mode)
    values (11,1,1);
    SELECT LAST_INSERT_ID();
    END
    and why that doesn't work when I call it from labview?
    when i replace last inserted id with:
    select max(session_id) as session from work_managment.sessions;
    it works good in labview
    What could be the problem??

    It could be that there is something screwy with LV, but given that it uses standard interfaces for comm with the DBMS, I would not expect that. A much more realistic possibility is that the toolkit is mucking things up. (A fairly common occurrence.)
    Try bypassing the toolbox -- which you don't really need anyway -- an talk directly to the ActiveX or .net interface.
    Also, what DBMS? What drivers are you using?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • JCA Database adapter - stored procedure xa or non xa datasource

    Hi
    I have a quick question about datasources. Does the database adapter support both xa and non xa? I am currently running in non xa I really do not need any xa functionality, but I am experiencing some calls to the database that takes a very long time. Might be an issue with the database tuning, but trying to cover all the bases.
    Have searched quite a lot on it, but cant find anything, so I hope some of you know.
    Thanks in advance.
    /Øyvind

    Does the database adapter support both xa and non xa? Yes, it supports both.
    but I am experiencing some calls to the database that takes a very long time. May be database is slow or data-source is not fine tuned. Does it happen under heavy load? What is the independent normal execution time and how much it is taking actually when you use DB adapter?
    Regards,
    Anuj

  • Passing parameter in stored procedure

    Hi, I am really new to using Oracle stored procedure. I have just tested a sample stored proc which should return multiple rows without passing any parameter.
    here is the stored proc I wrote
    create or replace procedure get_address
    as
    cur_table sys_refcursor;
    begin
    open cur_table for
    select * from address_table order by addr_id;
    end;
    when I execute it, I get a message "Procedure Created"
    then I executed the stored proc
    exec get_address;
    I again get a message "PL/SQL procedure successfully completed" and I do not see the records at all.
    so I decide to rewrite to the stored proc as such
    create or replace procedure get_address(cur_table out sys_refcursor)
    as
    begin
    open cur_table for
    select * from address_table order by addr_id;
    end;
    everthing is good so far.
    now when execute it
    exec get_address;
    I am getting the following error:
    "PLS-00306: wrong number or types of arguments in call to 'TESTCODEPROC'"
    I have searched so many places, but there is no document talks about this issue. I hope someone can help me to over come this. I need to call this stored proc from .NET 2.0 reporting viewer which is embedded in asp.net page.
    Thank you.

    so I decide to rewrite to the stored proc as such
    create or replace procedure get_address(cur_table out
    sys_refcursor)
    as
    begin
    open cur_table for
    select * from address_table order by addr_id;
    end;
    everthing is good so far.
    now when execute it
    exec get_address;
    I am getting the following error:
    "PLS-00306: wrong number or types of arguments in
    call to 'TESTCODEPROC'"
    From what you wrote I can assume that you have used SQL server before. Oracle does not automatically return the last opened cursor from a stored procedure like the query result, so you cannot just call exec get_address; (or just execute the procedure from .NET code). You will have to pass the cursor parameter and fetch it as an output parameter value in .NET, then use it to get the data reader etc.
    On the other hand, you can just execute the statement directly. I see a lot of folks coming from SQL server world using stored procedures like crazy even for things that are naturally suited to queries and views. Oracle view allows you to apply the same security restrictions you can put onto a stored procedure, and if you use statement caching and bound variables, you get precompilation benefits as well with a view. Using a view instead of a procedure in this case will require less code both in the database and in .NET, and will give you a more flexible interface in terms of retrieved columns and ordering.
    gojko adzic
    http://gojko.net

  • Toplink with stored procedures

    Hi
    I am new to Toplink and would like to get an idea whether Toplink would be suitable for our application. Currently, in our application we always access the database through stored procedures. I realize Toplink supports stored procuedres with StoredProcedureCall class. However; I am just trying to get some feedback as to whether using only this feature(as well as handling database connections etc.) of Toplink is a good idea or not.
    Thanks,
    Izi

    I have my entity manager setup in a singleton.
    I'm finding it's costly to generate the emf, but if I don't close the em (enitity manager) and emf (entity manager factory) my open cursor count climbs until I exceed the max number of open cursors on the database (11g RAC)
    I'm committing the connection, and uow, and closing the em at the end of each call.
    But until I close the emf, the open cursors aren't released.
    TransactionhistoryPkg tranPkg = new TransactionhistoryPkg(conn); //Class created over database package via JPublisher
    tranPkg.transactionhistoryInsSp(insertTrans.getCardId()); // executes db package
    tranPkg.closeConnection();
    conn.commit();
    uow.commit();
    uow.getAccessor().decrementCallCount();
    em.close();
    Am I missing something really obvious here??
    btw - I found this link helpful in troubleshooting the max cursors issue: https://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingORA-1000MaximumOpenCursorsExceededPattern.html

Maybe you are looking for

  • How to run the Oracle SOA Suite and all its prerequisites on different mach

    Greetings, Due to the difficulty to run the SOA Suite and all its prerequisites, including JDeveloper, on a single machine, I would like to deploy the admin server, the soa server and the bam server on separate machines. Is it possible and, if yes, h

  • Condition in select

    Hi All, I have a doubt in the following select query. select * from YL2_M_KOWM  into table  g_t_itab where KVEWE IN ('B') AND KAPPL IN ('WM') AND EVENT IN ('/RB04/YL4_EA') AND SPRAS IN ('D','*','') AND WERKS IN ('0780','*','') AND LGNUM IN ('001','*'

  • Sap Hana cloudshare links don't work for me-Blank page

    Hi Experts, I'm working on SPS06 Hana studio on cloudshare, now while executing data generator on IE, I'm getting blank page.Though Heading of blank page says Hana login at IE bar. Actions I took so far after reading so many forums are below:- I impo

  • Starting Multiple Meetings

    Hi !!! Can any one please give me procedure to start multiple meetings with single flash file using flash media server components. Let me explain clearly---- I started a meeting with flash media server components and deployed to tomacat. I can able t

  • Question about MyVegas games continually spinning out of control

    Windows 7 flashplayer version 16,0,0,235 Google Chrome MyVegas games will not stop spinning most of the time. Checked updates etc. all else works fine. Anyone else having same problem? All posts greatly appreciated.