Procedure to generate invoice in xml---please help

Hi all,
I have to write code review of a pakage which contain procedure to generate invoice in XML.The procedure contain two
files .pkb and .pks.All i know is that it will deliver elemt of the post script layout.?But i dont understand what it mean nor i am able to understand the code.I dont have any prior knowledge about this.Please help me and tell me any tutorial to understand and know how this is done.
Also i have pasted some part of code here .please help me in understanding what is going on.
help help help
* GET_INVOICE_XML
FUNCTION GET_INVOICE_XML(inInvId NUMBER) RETURN CLOB IS
BEGIN
  IF NOT isClobReady THEN
    dbms_lob.createtemporary(invClob, TRUE);
    isClobReady := TRUE;
  ELSE
    dbms_lob.trim(invClob, 0);
  END IF;
  vInvoice :=
    XML_VER_STR || NL ||
    ' <!DOCTYPE INVOICE_FILE SYSTEM "invoicfile.dtd">' || NL ||
    '<INVOICE_FILE VERSION="1.1">' || NL;
  GEN_PROLOG(InvId);
  GEN_INVOICE(InvId, 1);
  vInvoice := vInvoice ||
    '</INVOICE_FILE>' || NL || NL;
  APPEND_INVOICE(0);
  RETURN invClob;
END GET_INVOICE_XML;
PROCEDURE GEN_INVOICE(InvId NUMBER, inITBMode NUMBER) IS
vP1    PLS_INTEGER;
vP2    PLS_INTEGER;
vAtt     BOOLEAN;
inv      ABCINVOICE%ROWTYPE;
cdr_no   NUMBER;
t0       TIMESTAMP;
t1       TIMESTAMP;
execTime NUMBER(12,6);
BEGIN
  t0 := LOCALTIMESTAMP;
  SELECT * INTO inv FROM ABCINVOICE WHERE OACT = InvId;
  dti := inv.DTI;
  SELECT NVL(SUM(cdrNO),0) INTO cdr_no FROM ABCCONTRACTS WHERE OACT = InvId AND ITB IN ('Y', 'F');
  vInvoice := vInvoice ||
    ' <INVOICE>' || NL ||
    '  <HEADER>' || NL ||
    '   <SEQ>' || inv.SEQ || '/' || inv.PROC_ID || '</SEQ>' || NL ||
    '   <LEN ';
  vPos1 := INSTR(inv.LEN, '|', 1, 1);
  vInvoice := vInvoice || 'INV="' || SUBSTR(inv.LEN, 1, vPos1-1) || '" ';
  vPos2 := INSTR(inv.LEN, '|', vPos1+1, 1);
  vInvoice := vInvoice || 'BAL="' || SUBSTR(inv.LEN, vPos1+1, vPos2-vPos1-1) || '" ';
  vPos1 := INSTR(inv.LEN, '|', vPos2+1, 1);
  vInvoice := vInvoice || 'DET="' || SUBSTR(inv.LEN, vPos2+1, vPos1-vPos2-1) || '" ';
  vPos2 := INSTR(inv.LEN, '|', vPos1+1, 1);
  vInvoice := vInvoice || 'PDET="' || SUBSTR(inv.LEN, vPos1+1, vPos2-vPos1-1) || '" ';
  vPos1 := INSTR(inv.LEN, '|', vPos2+1, 1);
  vInvoice := vInvoice || 'ITM="' || SUBSTR(inv.LEN, vPos2+1, vPos1-vPos2-1) || '" ';
  vPos2 := INSTR(inv.LEN, '|', vPos1+1, 1);
  vInvoice := vInvoice || 'PITM="' || SUBSTR(inv.LEN, vPos1+1, vPos2-vPos1-1) || '" NTF="' ||
    SUBSTR(inv.LEN, vPos2+1) || '"/>' || NL;
  vInvoice := vInvoice ||
    '   <BAR>' || inv.BAR || '</BAR>' || NL ||
    '   <BCD>' || inv.BCD || '</BCD>' || NL ||
    CASE WHEN inv.BIC IS NULL THEN '' ELSE '   <BIC>' || inv.BIC || '</BIC>' || NL END ||
    '   <REF>' || inv.REF || '</REF>' || NL ||
    '   <OHX>' || inv.OHXACT || '</OHX>' || NL ||
    '   <CID>' || inv.CID || '</CID>' || NL ||
    '   <CCO>' || inv.CCO || '</CCO>' || NL ||
    '   <CND>' || inv.CND || '</CND>' || NL ||
    '   <PBF>' || inv.PBF || '</PBF>' || NL ||
    '   <DTI>' || inv.DTI || '</DTI>' || NL ||
    '   <DTD>' || inv.DTD || '</DTD>' || NL ||
    '   <DPS>' || inv.DPS || '</DPS>' || NL ||
    '   <DPE>' || inv.DPE || '</DPE>' || NL ||
    '   <DAS>' || inv.DAS || '</DAS>' || NL ||
    '   <DAE>' || inv.DAE || '</DAE>' || NL ||
    '   <PAY>' || inv.PAY || '</PAY>' || NL ||
    '   <NAM>' || ABCUTIL.CONVERT_POL_CHAR(inv.NAM) || '</NAM>' || NL ||
    CASE WHEN inv.ADS1 IS NULL THEN '' ELSE '   <ADS>' || ABCUTIL.CONVERT_POL_CHAR(inv.ADS1) || '</ADS>' || NL END ||
    CASE WHEN inv.ADS2 IS NULL THEN '' ELSE '   <ADS>' || ABCUTIL.CONVERT_POL_CHAR(inv.ADS2) || '</ADS>' || NL END ||
    '   <ADZ>' || ABCUTIL.CONVERT_POL_CHAR(inv.ADZ) || '</ADZ>' || NL ||
    '   <NIP>' || inv.NIP || '</NIP>' || NL ||
    '   <REG>' || inv.REG || '</REG>' || NL ||
    '   <PES>' || inv.PES || '</PES>' || NL ||
    '   <BCY>' || inv.BCY || '</BCY>' || NL ||
    '   <TXT>' || ABCUTIL.CONVERT_POL_CHAR(inv.TXT) || '</TXT>' || NL ||
    '   <GRO>' || TO_CHAR(inv.GRO, 'FM999990.90') || '</GRO>' || NL ||
    '   <FBL>' || inv.FBL || '</FBL>' || NL;
  IF inv.STP > 0 THEN
    GEN_TEXT(inInvId, 1);
  END IF;
  vInvoice := vInvoice ||
    '  </HEADER>' || NL ||
    '  <ADDRESS>' || NL ||
    '   <ENV>' || inv.ENV || '</ENV>' || NL ||
    '   <TNA>' || ABCUTIL.CONVERT_POL_CHAR(inv.TNA) || '</TNA>' || NL ||
    CASE WHEN inv.TAS1 IS NULL THEN '' ELSE '   <TAS>' || ABCUTIL.CONVERT_POL_CHAR(inv.TAS1) || '</TAS>' || NL END ||
    CASE WHEN inv.TAS2 IS NULL THEN '' ELSE '   <TAS>' || ABCUTIL.CONVERT_POL_CHAR(inv.TAS2) || '</TAS>' || NL END ||
    '   <TAZ>' ||ABCUTIL.CONVERT_POL_CHAR(inv.TAZ) || '</TAZ>' || NL;
  GEN_TEXT(inInvId, 2);
  vInvoice := vInvoice ||
    CASE WHEN inv.MTX  IS NULL THEN '' ELSE '   <MTX>' || inv.MTX  || '</MTX>' || NL END ||
    '  </ADDRESS>' || NL;
  APPEND_INVOICE(0);
  IF inv.BCY <> '99' THEN
    GEN_INVOICE_BILLING(inInvId);
    GEN_BALANCE(inInvId);
    vPos1 := INSTR(inv.LEN, '|', 1, 2) + 1;
    vPos2 := INSTR(inv.LEN, '|', vPos1, 1);
    vPos1 := SUBSTR(inv.LEN, vPos1, vPos2 - vPos1);
    IF vPos1 > 1 THEN
      GEN_SUMMARY(inInvId);
    END IF;
  END IF;
  vInvoice := vInvoice || ' </INVOICE>' || NL;
  APPEND_INVOICE(0);
END GEN_INVOICE;Edited by: BluShadow on 28-Aug-2012 09:46
added {noformat}{noformat} tags for readability. Please read: {message:id=9360002}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Not quite sure what you want to know about it.
If you want a code review of it, I can tell you it's very poor code, because that's not how to generate XML data in Oracle. Oracle has built in XML functionality for generating such data, and doesn't require hard-coding XML tags.
Here's the Oracle documentation...
http://tahiti.oracle.com/
pick your database version and search for things like XDB, SQLX or more specifically XMLELEMENT, XMLAGG, XMLATTRIBUTES etc.

Similar Messages

  • SO has no TAX, but its corresponding invoice does . Please Help.

    Hi All,
    I have this question regarding TAX.
    So, our SO in OM is showing 0.00 tax, but when we pull up the invoice(we are running Autoinvoice) for the same transaction it is calculating tax.
    I just need to understand what could be the possible reasoning behind it.
    Any help would be appreciated.
    Thanks again

    Hello Brian,
    In the end I called Apple myself and gave them my information such as the serial number, order number, IMEI etc and they made a case file out of it, I shipped it to the UK from my home in Trinidad and they DID identify a problem with the home button. Truth and in fact, that may or may not solve the problem, but they're supposed to be fixing it and I will receive it soon.
    The Apple Techs were really very helpful and they didn't make me seem crazy, but before you call them, make sure you wipe your phone out (restore it to factory settings) and DO NOT backup from the cloud after you're done. They will tell you that's the problem, when in fact, it isn't.

  • JAVA-XML Please Help

    Hello All,
    I'm somewhat new to Java and XML and I'm having this problem:
    I have an program that does an HTTP Post and gets back an XML response. I'm trying to parse the response. I'm completely lost I think, and I apologize for my utter stupidity or if I haven't provided enough information. What follows is a snippet of code and the error message I'm getting:
    //conn is my Http connection
    // get the results
         conn.connect(); // throws IOException
         int responseCode = conn.getResponseCode(); // 200, 404, etc
         String responseMsg = conn.getResponseMessage(); // OK, Forbidden, etc
    // Read the response XML document
    XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    org.xml.sax.ContentHandler handler = new DefaultHandler();
    parser.setContentHandler(handler);
    InputStream in = conn.getInputStream();
    InputSource source = new InputSource(in);
    parser.parse(source);
    in.close();
    conn.disconnect();
    Error Message:
    org.xml.sax.SAXParseException: The root element is required in a well-formed document.
    I think my problem is here but I'm not sure:
    org.xml.sax.ContentHandler handler = new DefaultHandler();
    Thanks for all of your help,
    Lance

    hi
    i think u should first read the file using JFlieChooseran d grt the file likr this:::::::
    public File getXMLFileChooser()
         //Create a file chooser
         fc     = new JFileChooser();
         String type[] = new String[] {"xml"};
         fc.addChoosableFileFilter(new MyFileFilter(type,"XML Files(*.xml)"));
    fc.setMultiSelectionEnabled(false);
    int returnVal = fc.showOpenDialog(XMLFileChooser.this);
         if (returnVal == JFileChooser.APPROVE_OPTION)
         file     =fc.getSelectedFile();
              return file;
    ///now this file is to be read using BufferedReader & FileInputStream
         File file;
         FileInputStream fis;
    BufferedReader bdr=null;
    String record=null;
    FileInputStream fis = new FileInputStream(file);
    bdr= new BufferedReader(new InputStreamReader(fis));
    while ( (record=bdr.readLine()) != null )
    ParseFile(record);//in this method u can parse the file
    if it something u want i can help u more....
    cheers||||

  • Java with xml please help me :(

    Hi,
    I need to design a Jva GUI interface where when an action is triggered the event will
    first look at some pattern(rules) defined in a XML file before been fired. I have no
    idea of how the communication is going to be established . I have never used xml in the past.
    Any help will be very very appreciated!
    Thank You

    Hello,
    Try to download Jaxp-1.1, U will get 3 JAR files - xalan.jar, crimson.jar and jaxp.jar.Set the classpath to this jar files. U will find the ZIP files in http://java.sun.com/xml/jaxp-1.1/docs/api, Iam not sure about the URl.Still need any help mail me to [email protected]
    Thanx

  • New line character and carriage return in XML, please help, thanks

    In XML, "&#10;" is only the new line character. I have tried that. If you put that in your XML, for example:
    <tag>line1&#10;line2&#10;line3</tag>
    You will get the output as follow:
    line1
    ____line2
    ________line3
    (where ___ represents space)
    The output that I want is actually like:
    line1
    line2
    line3
    So I would like to ask how I can do this.
    Thanks,
    Jackie

    while parsing your XML file you can directly suppress these newline and similar things in characters() method of SAX parser.
    you can opt to do nothing when you encounter them else if it is normal character then use it to print it.

  • Please help me with this procedure

    Hi guys. i am trying to create a procedure that inserts into the withdrawal table and then prints out the balance of the user. Again i have created a function called get_authority that checks if the user is authorized or not. i have been able to write the procedure but still get an error. please help me correct my mistake. thank u
    create or replace procedure do_withdrawal(
    p_cust_id in varchar2,
    p_acc_id in number,
    p_amount in number
    as
    v_cnr number(9);
    unauthorized Exception;
    begin
    select pk_seq.nextval into v_cnr from dual;
    insert into deposition(wit_id,cust_id,acc_id,amount,date_time ) values(v_cnr,p_cust_id,p_acc_id,p_amount,sysdate);
    commit;
    EXCEPTION
       when (get_authority = 0;) then
         Raise unauthorized,
       dbms_output.put_line('Unauthrorized User')
         else
            dbms_output.put_line('Dear Customer: Your balance is ')
    end;

    1002942 wrote:
    Hi guys. i am trying to create a procedure that inserts into the withdrawal table and then prints out the balance of the user. Again i have created a function called get_authority that checks if the user is authorized or not. i have been able to write the procedure but still get an error. please help me correct my mistake. thank u
    Just had a look on your procedure and modified your approach by assuming that you must be knowing what are going to achieve. Even your inputs look unclear and insufficient.
    -- Not tested
    create or replace procedure do_withdrawal(
    p_cust_id in varchar2,
    p_acc_id in number,
    p_amount in number
    is
    v_cnr number(9);   -- no need
    unauthorized Exception; -- no need
    begin
    --select pk_seq.nextval into v_cnr from dual;
    -- use seq directly
    if get_authority = 0 then
      raise_application_error(-20001, 'Unauthrorized User');
    else
      insert into deposition(wit_id,
           cust_id,
           acc_id,
           amount,
           date_time)
        values(pk_seq.nextval,
         p_cust_id,
         p_acc_id,
         p_amount,
         sysdate);
      commit;
      dbms_output.put_line('Dear Customer: Your balance is '||p_amount);
        end if; 
    exception
       when others then raise;  -- if you still want to catch some undefined error, then just raise it
    end;

  • Please help: deploy Bean with "No resource available" error for M:N relationship

    Hi all,
    I wonder any one comes across with deploying beans with M:N relationship with
    "No resource available".
    I defined the relationship in ejb-jar.xml and dbms in the
    weblogic-cmp-rdbms-jar.xml, but when I deployed the beans I got
    the following error
    ------ Error message-----
    weblogic.common.ResourceException: No resources available at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
    java:568) at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
    java:400) at weblogic.common.internal.ResourceAllocator.reserveNoWait(ResourceAllo
    cator.java:368) at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j
    ava:166) at weblogic.jdbc.common.internal.ConnectionPool.reserveNoWait(Connection
    Pool.java:127) at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiData
    Source.java:194) at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:219) at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getConnection(RDBMSP
    ersistenceManager.java:317) at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.createDefaultDBMSTab
    le(RDBMSPersistenceManager.java:1149) at weblogic.ejb20.utils.TableVerifier.verifyTableExistsAndCreateMaybe(Ta
    bleVerifier.java:428) at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.verifyTablesExist(RD
    Unable to deploy EJB: CustomerBean from \ejb:
    Errors encountered ''The Container-Managed Persistence Entity EJB failed while
    creating its SQL Type Map. The error was: Invalid object name 'localcustomer_localsubscription'.
    Severity 16, State 1, Procedure 'IVM_SERVER null', Line 1', 'Error encountered
    while attempting to create Default DBMS Table: 'localcustomer_localsubscription'.
    Error Text: 'weblogic.common.ResourceException: No resource s available'.''
    ---------------End error ----------------------
    ---------------my ejb-jar.xml
    <ejb-jar>
    - <enterprise-beans>
    - <entity>
    <ejb-name>AddressBean</ejb-name>
    <local-home>customer.LocalAddressHome</local-home>
    <local>customer.LocalAddress</local>
    <ejb-class>customer.AddressBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    - <cmp-field>
    <field-name>addressID</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>street</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>city</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>zip</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>state</field-name>
    </cmp-field>
    <primkey-field>addressID</primkey-field>
    </entity>
    - <entity>
    <ejb-name>CustomerBean</ejb-name>
    <local-home>customer.LocalCustomerHome</local-home>
    <local>customer.LocalCustomer</local>
    <ejb-class>customer.CustomerBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <abstract-schema-name>CustomerBean</abstract-schema-name>
    - <cmp-field>
    <field-name>customerID</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>firstName</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>lastName</field-name>
    </cmp-field>
    <primkey-field>customerID</primkey-field>
    - <query>
    - <query-method>
    <method-name>findByLastName</method-name>
    - <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    - <ejb-ql>
    - <![CDATA[ SELECT OBJECT(o) FROM CustomerBean AS o
      ]]>
    </ejb-ql>
    </query>
    - <query>
    - <query-method>
    <method-name>findByFirstName</method-name>
    - <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    - <ejb-ql>
    - <![CDATA[ SELECT OBJECT(o) FROM CustomerBean AS o
      ]]>
    </ejb-ql>
    </query>
    </entity>
    - <entity>
    <ejb-name>SubscriptionBean</ejb-name>
    <local-home>customer.LocalSubscriptionHome</local-home>
    <local>customer.LocalSubscription</local>
    <ejb-class>customer.SubscriptionBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <abstract-schema-name>SubscriptionBean</abstract-schema-name>
    - <cmp-field>
    <field-name>type</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>title</field-name>
    </cmp-field>
    <primkey-field>title</primkey-field>
    - <query>
    - <query-method>
    <method-name>findAllSubscriptions</method-name>
    <method-params />
    </query-method>
    - <ejb-ql>
    - <![CDATA[ SELECT OBJECT(o) FROM SubscriptionBean AS o
      ]]>
    </ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    - <relationships>
    - <ejb-relation>
    <ejb-relation-name>LocalCustomer-LocalAddress</ejb-relation-name>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalCustomer-Has-LocalAddresss</ejb-relationship-role-name>
    <multiplicity>one</multiplicity>
    - <relationship-role-source>
    <ejb-name>CustomerBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>addresses</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalAddress-Has-LocalCustomer</ejb-relationship-role-name>
    <multiplicity>many</multiplicity>
    - <relationship-role-source>
    <ejb-name>AddressBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>customer</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    - <ejb-relation>
    <ejb-relation-name>LocalCustomer-LocalSubscription</ejb-relation-name>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalCustomers-Have-LocalSubscriptions</ejb-relationship-role-name>
    <multiplicity>many</multiplicity>
    - <relationship-role-source>
    <ejb-name>CustomerBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>subscriptions</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalSubscriptions-Have-LocalCustomers</ejb-relationship-role-name>
    <multiplicity>many</multiplicity>
    - <relationship-role-source>
    <ejb-name>SubscriptionBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>customers</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    - <assembly-descriptor>
    - <container-transaction>
    - <method>
    <ejb-name>AddressBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    - <container-transaction>
    - <method>
    <ejb-name>CustomerBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    - <container-transaction>
    - <method>
    <ejb-name>SubscriptionBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ------------------End of ejb-jar.xml---------------
    Please help
    Thanks in advance
    Mike

    Hi Gaurav,
    Other applications used the same the datasource, which I used for this application,
    are running fine.
    I think there is some bug in the wlserver 6.1 to create the join table. I think
    it is the time I should ask the bea wlserver 6.1.
    Mike
    "Gaurav Khanna" <[email protected]> wrote:
    This implies that there are no database connections available. You need
    to
    check if you can log into your database instance. By default there are
    30
    connections specified for an instance in Oracle. FYI.
    "Mike" <[email protected]> wrote in message
    news:[email protected]...
    Hi all,
    I wonder any one comes across with deploying beans with M:Nrelationship with
    "No resource available".
    I defined the relationship in ejb-jar.xml and dbms in the
    weblogic-cmp-rdbms-jar.xml, but when I deployed the beans I got
    the following error
    ------ Error message-----
    weblogic.common.ResourceException: No resources available atweblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
    java:568) atweblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
    java:400) atweblogic.common.internal.ResourceAllocator.reserveNoWait(ResourceAllo
    cator.java:368) atweblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j
    ava:166) atweblogic.jdbc.common.internal.ConnectionPool.reserveNoWait(Connection
    Pool.java:127) atweblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiData
    Source.java:194) atweblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:219) atweblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getConnection(RDBMSP
    ersistenceManager.java:317) atweblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.createDefaultDBMSTab
    le(RDBMSPersistenceManager.java:1149) atweblogic.ejb20.utils.TableVerifier.verifyTableExistsAndCreateMaybe(Ta
    bleVerifier.java:428) atweblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.verifyTablesExist(RD
    Unable to deploy EJB: CustomerBean from \ejb:
    Errors encountered ''The Container-Managed Persistence Entity EJB failedwhile
    creating its SQL Type Map. The error was: Invalid object name'localcustomer_localsubscription'.
    Severity 16, State 1, Procedure 'IVM_SERVER null', Line 1', 'Errorencountered
    while attempting to create Default DBMS Table:'localcustomer_localsubscription'.
    Error Text: 'weblogic.common.ResourceException: No resource savailable'.''
    ---------------End error ----------------------
    ---------------my ejb-jar.xml
    <ejb-jar>
    - <enterprise-beans>
    - <entity>
    <ejb-name>AddressBean</ejb-name>
    <local-home>customer.LocalAddressHome</local-home>
    <local>customer.LocalAddress</local>
    <ejb-class>customer.AddressBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    - <cmp-field>
    <field-name>addressID</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>street</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>city</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>zip</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>state</field-name>
    </cmp-field>
    <primkey-field>addressID</primkey-field>
    </entity>
    - <entity>
    <ejb-name>CustomerBean</ejb-name>
    <local-home>customer.LocalCustomerHome</local-home>
    <local>customer.LocalCustomer</local>
    <ejb-class>customer.CustomerBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <abstract-schema-name>CustomerBean</abstract-schema-name>
    - <cmp-field>
    <field-name>customerID</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>firstName</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>lastName</field-name>
    </cmp-field>
    <primkey-field>customerID</primkey-field>
    - <query>
    - <query-method>
    <method-name>findByLastName</method-name>
    - <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    - <ejb-ql>
    - <![CDATA[ SELECT OBJECT(o) FROM CustomerBean AS o
    ]]>
    </ejb-ql>
    </query>
    - <query>
    - <query-method>
    <method-name>findByFirstName</method-name>
    - <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    - <ejb-ql>
    - <![CDATA[ SELECT OBJECT(o) FROM CustomerBean AS o
    ]]>
    </ejb-ql>
    </query>
    </entity>
    - <entity>
    <ejb-name>SubscriptionBean</ejb-name>
    <local-home>customer.LocalSubscriptionHome</local-home>
    <local>customer.LocalSubscription</local>
    <ejb-class>customer.SubscriptionBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <abstract-schema-name>SubscriptionBean</abstract-schema-name>
    - <cmp-field>
    <field-name>type</field-name>
    </cmp-field>
    - <cmp-field>
    <field-name>title</field-name>
    </cmp-field>
    <primkey-field>title</primkey-field>
    - <query>
    - <query-method>
    <method-name>findAllSubscriptions</method-name>
    <method-params />
    </query-method>
    - <ejb-ql>
    - <![CDATA[ SELECT OBJECT(o) FROM SubscriptionBean AS o
    ]]>
    </ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    - <relationships>
    - <ejb-relation>
    <ejb-relation-name>LocalCustomer-LocalAddress</ejb-relation-name>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalCustomer-Has-LocalAddresss</ejb-relationshi
    p-role-name>
    <multiplicity>one</multiplicity>
    - <relationship-role-source>
    <ejb-name>CustomerBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>addresses</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalAddress-Has-LocalCustomer</ejb-relationship
    -role-name>
    <multiplicity>many</multiplicity>
    - <relationship-role-source>
    <ejb-name>AddressBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>customer</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    - <ejb-relation>
    <ejb-relation-name>LocalCustomer-LocalSubscription</ejb-relation-name>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalCustomers-Have-LocalSubscriptions</ejb-rela
    tionship-role-name>
    <multiplicity>many</multiplicity>
    - <relationship-role-source>
    <ejb-name>CustomerBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>subscriptions</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    - <ejb-relationship-role>
    <ejb-relationship-role-name>LocalSubscriptions-Have-LocalCustomers</ejb-rela
    tionship-role-name>
    <multiplicity>many</multiplicity>
    - <relationship-role-source>
    <ejb-name>SubscriptionBean</ejb-name>
    </relationship-role-source>
    - <cmr-field>
    <cmr-field-name>customers</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    - <assembly-descriptor>
    - <container-transaction>
    - <method>
    <ejb-name>AddressBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    - <container-transaction>
    - <method>
    <ejb-name>CustomerBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    - <container-transaction>
    - <method>
    <ejb-name>SubscriptionBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ------------------End of ejb-jar.xml---------------
    Please help
    Thanks in advance
    Mike

  • Please help me to tune this PL/SQL...

    Hi everyone,
        I have a SQL query which runs ok when i run it individually but the same query if
    i use it in a procedure.The procedure is hanging up.Could someone please help to tune this
    SQL query and please check my procedure why is it hanging up.
    SQL Query
    =========
    SELECT active_members.member_nbr,
      active_members.name_last,
      active_members.name_first,
      active_members.name_middle,
      active_members.dob,
      active_members.sex,
      active_members.subsciber_nbr,
      active_members.ssn,
      active_members.name_suffix,
      active_members.class_x,
      active_members.aff_nbr,
    CASE
    WHEN TRIM(active_members.class_x) = 'SE' THEN
        (SELECT DISTINCT(mssp.member_nbr)
         FROM member_span mssp
         WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
         AND mssp.class_x = 'SP'
         AND rownum = 1)
       WHEN TRIM(active_members.class_x) = 'SP' THEN
          (SELECT DISTINCT(mssp.member_nbr)
           FROM member_span mssp
           WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
           AND mssp.class_x = 'SE'
           AND rownum = 1)
      ELSE
        NULL
       END)
    spouse_member_nbr,
      active_members.division_nbr,
      active_members.ymdeff,
      active_members.ymdend,
      active_members.actual_ymd_enddt,
      active_members.email_id,
      active_members.network_id,
      active_members.insurance_company_code,
      active_members.cob_flag,
      active_members.vip_flag,
      active_members.pre_x_flag,
      active_members.region,
      active_contracts.language_x,
      active_contracts.corp_nbr,
      active_members.group_nbr,
      active_members.non_erisa_status
    FROM
      (SELECT mb_active.member_nbr,
         mb_active.contract_nbr,
         mb_active.name_last,
         mb_active.name_first,
         mb_active.name_middle,
         ms_active.ymdeff,
         ms_active.ymdend,
         to_char(to_date(
       CASE
       WHEN LENGTH(mb_active.ymdbirth) = 8 THEN mb_active.ymdbirth
       ELSE NULL
       END,    'YYYYMMDD'),    'MM/DD/YYYY') dob,
         mb_active.sex,
         to_char(to_date(ms_active.ymdeff,    'YYYYMMDD'),    'MM/DD/YYYY') ymdeff_formatted,
         to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY') ymdend_formatted,
         ms_active.void,
       CASE
       WHEN SUBSTR(mb_active.member_nbr,    10,    2) = '00' THEN mb_active.member_nbr
       ELSE SUBSTR(mb_active.member_nbr,    1,    9) || '00'
       END) subsciber_nbr,
         mb_active.ssn,
         mb_active.name_suffix,
         ms_active.class_x,
         ms_active.aff_nbr,
         ms_active.division_nbr,
       CASE
       WHEN TRIM(ms_active.ymdend) = '99991231' THEN NULL
       ELSE to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY')
       END) actual_ymd_enddt,
       CASE
       WHEN TRIM(ms_active.business_unit) = '01' THEN ms_active.business_unit || '-' || ms_active.prog_nbr
       WHEN TRIM(ms_active.business_unit) = '03' THEN ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier
       ELSE NULL
       END) network_id,
         ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier insurance_company_code,
          (SELECT DISTINCT(email)
         FROM dbo.av_mem_email
         WHERE dbo.av_mem_email.member_nbr = mb_active.member_nbr
         AND rownum = 1)
      email_id,
         mb_active.lr_response cob_flag,
         mb_active.record_nbr vip_flag,
         ms_active.pre_exist pre_x_flag,
         ms_active.region region,
         ms_active.group_nbr,
       CASE
       WHEN
        (SELECT TRIM(div.div_status)
         FROM division div
         WHERE TRIM(div.division_nbr) = TRIM(ms_active.division_nbr)) = 'NULL' THEN
          'Y'
         ELSE
          'N'
         END)
      non_erisa_status
       FROM member mb_active,
         member_span ms_active
       WHERE mb_active.member_nbr = ms_active.member_nbr
       AND(20090707 BETWEEN ms_active.ymdeff
       AND ms_active.ymdend
       AND TRIM(ms_active.void) IS NULL
    active_members,
        (SELECT DISTINCT(contract.contract_nbr),
         contract.language_x,
         contract_span.corp_nbr
       FROM contract,
         contract_span
       WHERE contract.contract_nbr = contract_span.contract_nbr
       AND(20090707 BETWEEN contract_span.ymdeff
       AND contract_span.ymdend)
       AND TRIM(contract_span.void) IS
      NULL)
    active_contracts
    WHERE TRIM(active_members.contract_nbr) = TRIM(active_contracts.contract_nbr);
    Taking around 6 minute to run and it returns """"268267"""" records
    Explain Plan for the above SQL:
    ===============================
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 379550299"
    "| Id  | Operation                      | Name          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
    "|   0 | SELECT STATEMENT               |               |  2609K|   659M|       | 91679   (3)| 00:18:21 |"
    "|   1 |  HASH UNIQUE                   |               |     1 |    16 |       | 54461   (2)| 00:10:54 |"
    "|*  2 |   COUNT STOPKEY                |               |       |       |       |            |          |"
    "|*  3 |    TABLE ACCESS FULL           | MEMBER_SPAN   | 12891 |   201K|       | 54459   (2)| 00:10:54 |"
    "|   4 |    HASH UNIQUE                 |               |     1 |    16 |  2424K| 54736   (2)| 00:10:57 |"
    "|*  5 |     COUNT STOPKEY              |               |       |       |       |            |          |"
    "|*  6 |      TABLE ACCESS FULL         | MEMBER_SPAN   | 51541 |   805K|       | 54459   (2)| 00:10:54 |"
    "|   7 |  HASH UNIQUE                   |               |     1 |    50 |       |    64   (4)| 00:00:01 |"
    "|*  8 |   COUNT STOPKEY                |               |       |       |       |            |          |"
    "|*  9 |    TABLE ACCESS FULL           | AV_MEM_EMAIL  |     1 |    50 |       |    63   (2)| 00:00:01 |"
    "|* 10 |  TABLE ACCESS FULL             | DIVISION      |     1 |    14 |       |     3   (0)| 00:00:01 |"
    "|* 11 |  HASH JOIN                     |               |  2609K|   659M|       | 91679   (3)| 00:18:21 |"
    "|  12 |   VIEW                         |               |   581 | 12782 |       |  8184   (4)| 00:01:39 |"
    "|  13 |    HASH UNIQUE                 |               |   581 | 26145 |       |  8184   (4)| 00:01:39 |"
    "|  14 |     TABLE ACCESS BY INDEX ROWID| CONTRACT      |     1 |    14 |       |     2   (0)| 00:00:01 |"
    "|  15 |      NESTED LOOPS              |               |   581 | 26145 |       |  8183   (4)| 00:01:39 |"
    "|* 16 |       TABLE ACCESS FULL        | CONTRACT_SPAN |   581 | 18011 |       |  7019   (5)| 00:01:25 |"
    "|* 17 |       INDEX RANGE SCAN         | CONTRACT_IX1  |     1 |       |       |     1   (0)| 00:00:01 |"
    "|* 18 |   HASH JOIN                    |               |   449K|   104M|    39M| 83466   (2)| 00:16:42 |"
    "|* 19 |    TABLE ACCESS FULL           | MEMBER_SPAN   |   449K|    34M|       | 54964   (3)| 00:11:00 |"
    "|  20 |    TABLE ACCESS FULL           | MEMBER        |  1436K|   221M|       | 14664   (2)| 00:02:56 |"
    "Predicate Information (identified by operation id):"
    "   2 - filter(ROWNUM=1)"
    "   3 - filter(SUBSTR("MSSP"."MEMBER_NBR",1,9)=SUBSTR(:B1,1,9) AND "MSSP"."CLASS_X"='SP')"
    "   5 - filter(ROWNUM=1)"
    "   6 - filter(SUBSTR("MSSP"."MEMBER_NBR",1,9)=SUBSTR(:B1,1,9) AND "MSSP"."CLASS_X"='SE')"
    "   8 - filter(ROWNUM=1)"
    "   9 - filter("AV_MEM_EMAIL"."MEMBER_NBR"=:B1)"
    "  10 - filter(TRIM("DIV"."DIVISION_NBR")=TRIM(:B1))"
    "  11 - access(TRIM("MB_ACTIVE"."CONTRACT_NBR")=TRIM("ACTIVE_CONTRACTS"."CONTRACT_NBR"))"
    "  16 - filter("CONTRACT_SPAN"."YMDEFF"<=20090707 AND TRIM("CONTRACT_SPAN"."VOID") IS NULL AND "
    "              "CONTRACT_SPAN"."YMDEND">=20090707)"
    "  17 - access("CONTRACT"."CONTRACT_NBR"="CONTRACT_SPAN"."CONTRACT_NBR")"
    "  18 - access("MB_ACTIVE"."MEMBER_NBR"="MS_ACTIVE"."MEMBER_NBR")"
    "  19 - filter(TRIM("MS_ACTIVE"."VOID") IS NULL AND "MS_ACTIVE"."YMDEFF"<=20090707 AND "
    "              "MS_ACTIVE"."YMDEND">=20090707)"
    SAME SQL IN A PROCEDURE..IT IS HANGING UP
    ========================================
    create or replace PROCEDURE TEST_CURRENT_PCP_SPAN is
    EXTRACTED_STRING VARCHAR2(32767);
    FILEHANDLER UTL_FILE.FILE_TYPE;
    test_str varchar2(100);
    pcp_eff_date number(10);
    file_name varchar2(50);
       CURSOR MEMBERS
       IS
    SELECT active_members.member_nbr,
      active_members.name_last,
      active_members.name_first,
      active_members.name_middle,
      active_members.dob,
      active_members.sex,
      active_members.subsciber_nbr,
      active_members.ssn,
      active_members.name_suffix,
      active_members.class_x,
      active_members.aff_nbr,
    CASE
    WHEN TRIM(active_members.class_x) = 'SE' THEN
        (SELECT DISTINCT(mssp.member_nbr)
         FROM member_span mssp
         WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
         AND mssp.class_x = 'SP'
         AND rownum = 1)
       WHEN TRIM(active_members.class_x) = 'SP' THEN
          (SELECT DISTINCT(mssp.member_nbr)
           FROM member_span mssp
           WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
           AND mssp.class_x = 'SE'
           AND rownum = 1)
      ELSE
        NULL
       END)
    spouse_member_nbr,
      active_members.division_nbr,
      active_members.ymdeff,
      active_members.ymdend,
      active_members.actual_ymd_enddt,
      active_members.email_id,
      active_members.network_id,
      active_members.insurance_company_code,
      active_members.cob_flag,
      active_members.vip_flag,
      active_members.pre_x_flag,
      active_members.region,
      active_contracts.language_x,
      active_contracts.corp_nbr,
      active_members.group_nbr,
      active_members.non_erisa_status
    FROM
      (SELECT mb_active.member_nbr,
         mb_active.contract_nbr,
         mb_active.name_last,
         mb_active.name_first,
         mb_active.name_middle,
         ms_active.ymdeff,
         ms_active.ymdend,
         to_char(to_date(
       CASE
       WHEN LENGTH(mb_active.ymdbirth) = 8 THEN mb_active.ymdbirth
       ELSE NULL
       END,    'YYYYMMDD'),    'MM/DD/YYYY') dob,
         mb_active.sex,
         to_char(to_date(ms_active.ymdeff,    'YYYYMMDD'),    'MM/DD/YYYY') ymdeff_formatted,
         to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY') ymdend_formatted,
         ms_active.void,
       CASE
       WHEN SUBSTR(mb_active.member_nbr,    10,    2) = '00' THEN mb_active.member_nbr
       ELSE SUBSTR(mb_active.member_nbr,    1,    9) || '00'
       END) subsciber_nbr,
         mb_active.ssn,
         mb_active.name_suffix,
         ms_active.class_x,
         ms_active.aff_nbr,
         ms_active.division_nbr,
       CASE
       WHEN TRIM(ms_active.ymdend) = '99991231' THEN NULL
       ELSE to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY')
       END) actual_ymd_enddt,
       CASE
       WHEN TRIM(ms_active.business_unit) = '01' THEN ms_active.business_unit || '-' || ms_active.prog_nbr
       WHEN TRIM(ms_active.business_unit) = '03' THEN ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier
       ELSE NULL
       END) network_id,
         ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier insurance_company_code,
          (SELECT DISTINCT(email)
         FROM dbo.av_mem_email
         WHERE dbo.av_mem_email.member_nbr = mb_active.member_nbr
         AND rownum = 1)
      email_id,
         mb_active.lr_response cob_flag,
         mb_active.record_nbr vip_flag,
         ms_active.pre_exist pre_x_flag,
         ms_active.region region,
         ms_active.group_nbr,
       CASE
       WHEN
        (SELECT TRIM(div.div_status)
         FROM division div
         WHERE TRIM(div.division_nbr) = TRIM(ms_active.division_nbr)) = 'NULL' THEN
          'Y'
         ELSE
          'N'
         END)
      non_erisa_status
       FROM member mb_active,
         member_span ms_active
       WHERE mb_active.member_nbr = ms_active.member_nbr
       AND(20090707 BETWEEN ms_active.ymdeff
       AND ms_active.ymdend
       AND TRIM(ms_active.void) IS NULL
    active_members,
        (SELECT DISTINCT(contract.contract_nbr),
         contract.language_x,
         contract_span.corp_nbr
       FROM contract,
         contract_span
       WHERE contract.contract_nbr = contract_span.contract_nbr
       AND(20090707 BETWEEN contract_span.ymdeff
       AND contract_span.ymdend)
       AND TRIM(contract_span.void) IS
      NULL)
    active_contracts
    WHERE TRIM(active_members.contract_nbr) = TRIM(active_contracts.contract_nbr);
      TYPE MEM IS TABLE OF MEMBERS%ROWTYPE INDEX BY PLS_INTEGER;
      TABLE_MEM MEM;
    MEMBER_ADDR   MGONZALEZ.CPKG_UTIL.ADDR;
    BEGIN 
       test_str := '''A10000213'''||','||'''A10000213''';
       insert into test_number_char(str) values ('start time of MEMBER_LOAD_CURRENT_PCP_SPAN '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
       commit;
       file_name := 'member_load'||to_char(sysdate,'YYYYMMDDHH24MI')||'.txt';
       FILEHANDLER := UTL_FILE.FOPEN('AVMED_UTL_FILE',file_name, 'W',10000);
       insert into test_number_char(str) values ('start time of opening members cursor(before open members command) '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
       commit;
       OPEN MEMBERS;
    LOOP
          FETCH MEMBERS
             BULK COLLECT INTO TABLE_MEM LIMIT 1000 ;
           EXIT WHEN TABLE_MEM.COUNT = 0;
    insert into test_number_char(str) values ('start time of outer loop '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
    commit;
          FOR i IN 1 .. TABLE_MEM.COUNT
          LOOP
          EXTRACTED_STRING := TRIM(TABLE_MEM(i).MEMBER_NBR)||'| '||     
                              TRIM(TABLE_MEM(i).NAME_LAST)||'| '||      
                            TRIM(TABLE_MEM(i).NAME_FIRST)||'| '||      
                             TRIM(TABLE_MEM(i).NAME_MIDDLE)||'| '||   
                             TRIM(TABLE_MEM(i).ssn)||'| '||            
                             TABLE_MEM(i).subsciber_nbr||'| '||        
                             TRIM(TABLE_MEM(i).class_x)||'| '||         
                             TRIM(TABLE_MEM(i).DOB)||'| '||             
                             TRIM(TABLE_MEM(i).SEX)||'| ' ;             
              EXTRACTED_STRING   :=
                    EXTRACTED_STRING ||
                  TRIM(TABLE_MEM(i).aff_nbr)||'| '||                         
                                pcp_eff_date||'| '||                 
              TABLE_MEM(i).actual_ymd_enddt||'| '||                        
                  TRIM(TABLE_MEM(i).division_nbr)||'| '||                    
                  ' '||'| '||                                               
                  ' '||'| '||                                                  
                  ' '||'| '||                                                 
                  TABLE_MEM(i).network_id||'| '||                              
                  ' '||'| '||                                                  
                  ' '||'| '||                                                  
                  ' '||'| '||                                                  
                  ' '||'| '||                                                 
                  ' '||'| '||                                                  
                 TRIM(TABLE_MEM(i).name_suffix)||'| '||                       
                 ' '||'| '||                                                   
                 TRIM(TABLE_MEM(i).spouse_member_nbr)||'| '||                  
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                  
                 ' '||'| '||                                                   
                 ' '||'| '||                                                  
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                  
                 ' '||'| '||                                                   
                TRIM(TABLE_MEM(i).email_id)||'| '||                                
                TABLE_MEM(i).Insurance_company_code||'| '||                    
                TABLE_MEM(i).group_nbr||'| '||                                 
                TABLE_MEM(i).language_x||'| '||                               
                TABLE_MEM(i).region||'| '||                                    
                TABLE_MEM(i).corp_nbr||'| '||                                  
                TABLE_MEM(i).non_erisa_status||'| '||                          
                TABLE_MEM(i).cob_flag||'| '||                                  
                TABLE_MEM(i).pre_x_flag||'| '||                                
                TABLE_MEM(i).vip_flag                                       
                 EXTRACTED_STRING   := rtrim(EXTRACTED_STRING,' ');
            UTL_FILE.PUT_LINE(FILEHANDLER,EXTRACTED_STRING,TRUE);
            EXTRACTED_STRING := NULL;
            pcp_eff_date := NULL;
          END LOOP;
          insert into test_number_char(str) values ('end time of outer loop '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
    commit;
    END LOOP;
    close members;
    insert into test_number_char(str) values ('end time of opening members cursor '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
    commit;
    commit;
       UTL_FILE.FCLOSE(FILEHANDLER);
       insert into test_number_char(str) values ('End time of MEMBER_LOAD_CURRENT_PCP_SPAN '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
       commit;
       EXCEPTION
          WHEN OTHERS
          THEN
             DBMS_OUTPUT.put_line(   'ERROR getting members '
                                  || SQLCODE
                                  || ' '
                                  || SQLERRM);
    END ;
    In my Test table which i am inserting to check the times...
    I am geting on these 2 records after that it hangs up...
    start time of MEMBER_LOAD_CURRENT_PCP_SPAN 07/08/2009 11:41:21
    start time of opening members cursor(before open members command) 07/08/2009 11:41:21I have to call some other functions for each member to get additional details thats the reason i am going for Procedure.Instead it is just a simple SQL
    Thanks in advance

    It is taking lot of timeYou could perhaps split it up in smaller, isolated parts.
    Running certain steps separate.
    ..is it possible to find out the issues without running the proc?Other than have other people on OTN give their ideas/share experiences?
    Not that I'm aware of.
    There are lots of statistical views, you might be able to deduct from their data, but I personally prefer running the procedure and just trace it. But I'm always willing to learn new approaches, btw.
    Still, you have 2 things to look at, at least:
    - avoid loops in loops if possible
    - check your predicates, if you apply a function, you lose the index, unless you create a function based index.
    edit
    One more thing (how could I overlook that):
    You commit your instrumentation code ( insert into test_number_char(str) ) IN the loop.
    Please remove commit in your loops...
    Commit only once, at the end of your transaction.
    Never commit in a loop.
    (Preferrably the client commits)
    And remove every commit in your loop...
    Edited by: hoek on Jul 8, 2009 8:03 PM

  • Please help for User defined extension functions

    the tutorial given for extension functions doesn't work as well as our new functions
    even though i follow all the given steps and see the functions in my user defined extension functions tab in xslt map.
    all the target nodes that use the extension function disappear in the resulted target xml.
    please help.

    have you compiled your java file and uploaded the jar file(containg the .class file and the Manifest.MF file) in the <OC4J_HOME>\j2ee\home\applib directory and then restarted the server??

  • Please please please help me to solve problem

    hi everybody,
    i am facing the problem when am upload the table from one system to another.i was able to import and export the applications but i was unable to import and export the tables and schemas.what i have to do? what is the procedure to do?
    can anybody please help me to solve this problem.....
    regards,
    vally.s

    hi chrissy,
    i have exported the table succesfully, when am import the table to another schema it shows the error get block error. and also i was tried with upload the table , it is also unsuceesfull, it shows the error application id is inconsistent, can you please tell me the difference between upload and lmport in the sql workshop(you can find this in sql script page)
    regards
    vally.s

  • Please help! - Artwork for podcast doesn't show up in iTunes store.

    Hi there - My artwork doesn't show up in the iTunes store.
    Artwork shows up fine in the downloaded episodes, but in the store, only the "plain" podcast icon shows up. It's been nearly a week.
    -I published my feed with Feeder and host it on my site
    -Feedburner pulls it in
    -I submitted it myself in iTunes (using the feedburner feed-need it for stats)
    -I have been approved, and people have started subscribing.
    -Feed has been vetted, and appears to be ok.
    iTunes link: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=3485...
    Feedburner Link: http://feeds.feedburner.com/meetingwithmasters
    True feed: feed://bonehead.us/mwm.xml
    Please help!
    Thanks!
    DrJ

    The image is correctly referenced in the feed and there is an image at that URL. Some people have found that it takes some time for the image to appear, even after the podcast itself has been approved and appeared in the Store. so I should give it another few days.

  • Please help regarding a PL/SQL Code for padding of digits

    I have a table named as EWT_POL_AGT_REL. There is column named PDT_AGENT_NBR present in this table. The data type of this column is
    VARCHAR2(8 byte). There are some records in with pdt_agent_nbr having 8 spaces and some starting with zero such as “08400”. So I want
    to do following things 1.)left-append a '0' in front of the existing 5 digit PDT_AGENT_NBR and make it to 8 digits 2) if the existing PDT_AGENT_NBR is already 8 digits, do nothing 3.) if it contains leading spaces then replace them by zero.
    Sceanrios
    if PDT_AGENT_NBR is " 12345" then i should get "00012345"
    if PDT_AGENT_NBR is "1234" then i should get "00001234"
    This table has nearly 180 million records hence an update query will not work. Instead a PL/SQL procedure needs to be developed.
    Please help me on this. Please

    This table has nearly 180 million records hence an update query will not work. Because..................?
    Instead a PL/SQL procedure needs to be developed.So you want it to be slower?

  • Accounting document not generating for excise invoice-please help

    Dear all ,
    my issue is
    accounting document not generating for excise invoice
    we are creating accounting document in J1iin
    with refferance to billing document but the accounting docuemnt is not generating
    the accounting document for billing document is generated
    so why the accounting document for excise invoice is not genrating its showing the correct amount in BED ,cee and HE Secc.
    please help

    Dear G. Lakshmipathi,
    As uknow i am getting problem when i am creating the debit memo
    so is there any specific ETT for debit memo is there .because we are not maintaining delivery type to billing type here in CIN setting
    so its not goods removal through sales . so what will be transaction type for this.
    how to check the error that why the accounting document is not generated as no error log is also comming.
    so please help me in this regards.
    Thanks with Regards
    Subrat

  • Writing a Procedure to return back XML. Please help.

    Hello,
    I am writing a procedure in Oracle 10G,that will return back an XML
    to me.
    I am passing 2 parameters to this procedure (a Quantity and a Price) and these parameters are element values of the XML that will be returned.
    My Query is :
    1) How can the arguments being passed to the procedure become element values.
    2) Is my procedure to return back the XML correct.? Please can someone modify this procedure?
    Please can someone help me with this procedure as this is a PROD issue.
    Help really appreciated.
    PROCEDURE getTradeXML(qty IN VARCHAR2,price IN VARCHAR2 xml IN OUT CLOB)
    IS
    xml CLOB;
    BEGIN
    xml  = 'SELECT XMLELEMENT("Trade", XMLELEMENT("Quantity",qty),
                                        XMLELEMENT("Price", price))
              FROM DUAL'
    END;

    PROCEDURE getTradeXML(qty IN VARCHAR2,price IN
    VARCHAR2 xml IN OUT CLOB)
    IS
    xml CLOB;
    BEGIN
    xml  = 'SELECT XMLELEMENT("Trade",
    XMLELEMENT("Quantity",qty),
    MLELEMENT("Price", price))
    FROM DUAL'maybe you want
    SELECT XMLELEMENT("Trade", XMLELEMENT("Quantity",qty), XMLELEMENT("Price", price)) into xml FROM DUAL;
    /*not tested*/

  • How to make XML element used in RTF PRIVATE/PUBLIC ? I know how to hide columns in RTF, but dont know how to generate the xml in below way. Please help.

    Hi
    I am following below link to hide/show my columns dynamically. See "Column Formatting"
    http://docs.oracle.com/cd/E12844_01/doc/bip.1013/e12187.pdf
    As per doc, element can be made private/public.
    <items type="PUBLIC">
    <item>
      <name>Plasma TV</name>
      <quantity>10</quantity>
      <price>4000</price>
    </item>
    <item>
    And same can be used to hide the column using condition
    <?if@column:/items/@type="PUBLIC"?>
    MY QUESTION IS HOW TO DO THIS IN MY XML BELOW?
    Below is part of my XML code which I am using in Data Definition for RTF.
    <group name="GH3" source="QH3">
    <element name="COLUMN_HEAD3" value="COLUMN_NAME" />
    </group>
    <group name="GH4" source="QH4">
    <element name="COLUMN_HEAD4" value="COLUMN_NAME" />
    </group>
    I am getting output like this.
    <LIST_GH3>
    <GH3>
    <COLUMN_HEAD3>REBILL_TO_OTHER_BUSINESS_UNIT</COLUMN_HEAD3>
    </GH3>
    </LIST_GH3>
    <LIST_GH4>
    <GH4>
    <COLUMN_HEAD4>XYZ</COLUMN_HEAD4>
    </GH4>
    </LIST_GH4>
    In order to use logic as per oracle document I want output like this.
    <LIST_GH3 type="PUBLIC">
    <GH3>
    <COLUMN_HEAD3>REBILL_TO_OTHER_BUSINESS_UNIT</COLUMN_HEAD3>
    </GH3>
    </LIST_GH3>
    <LIST_GH4 type="PRIVATE">
    <GH4>
    <COLUMN_HEAD4>BLANK</COLUMN_HEAD4>
    </GH4>
    </LIST_GH4>
    What changes I need to make in my XML code to get the runtime output as above? Please help. Where do i need to make changes in the above xml? Group name? Element name?
    I am planning to use below condition in RTF template to hide the column,  but dont know how to set the type of column as PRIVATE/PUBLIC in the XML output used to populate data in the RTF at runtime.
    <?if@column:/BTSPIEXP/LIST_GH3/@type=”PUBLIC”?>COLUMN_HEAD3<?end if?>
    Regards,
    Swapnil K.

    Hi,
    Issue has been resolved. I used the value of the element to determine to display it or not.
    Regards,
    Swapnil K.

Maybe you are looking for