Report based on plsql table type

Is it possible crete a report (updatable) based on plsql table type?
thank in advance
Franco Galante

Sorry for my cryptic question, i wanted to mean create a report based on a stored procedure
function which return a plsql table type variable.
This idea could give me the chance to work with variable (plsql table) instead of db table.
hope i'm enough clear
thank you again
Franco Galante

Similar Messages

  • Mapping of PLSQL  table type  Date to java

    i am having problem in mapping plsql table type DATE in java,
    able to execute procedures which return plsql table type NUMBER,VARCHAR.
    i am using oracle 9 , jdk1.4, oci driver, windows 2000.
    sample code:
    registering:
    st.registerIndexTableOutParameter(15,100,OracleTypes.DATE,1000);
    st.registerIndexTableOutParameter(16,100,OracleTypes.DATE,1000);
    st.execute();
    getting out params in arrays:
    java.sql.Date[] O_lSubFolder_CrOn=(java.sql.Date[])java.sql.Date[] st.getPlsqlIndexTable(15);
    O_lSubFolder_MdOn=(java.sql.Date[])st.getPlsqlIndexTable(16);
    error while executing the code:
    java.sql.SQLException: Invalid PL/SQL Index Table element type
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
    at oracle.jdbc.driver.OraclePreparedStatement.checkPlsqlIndexTableBindTypes(OraclePreparedSt
    atement.java:2705)
    at oracle.jdbc.driver.OracleCallableStatement.registerIndexTableOutParameter(OracleCallableS
    tatement.java:834)
    can anyone help me to solve this problem.

    i am having problem in mapping plsql table type
    DATE in java,
    able to execute procedures which return plsql table
    type NUMBER,VARCHAR.
    i am using oracle 9 , jdk1.4, oci driver, windows
    2000.
    sample code:
    registering:
    st.registerIndexTableOutParameter(15,100,OracleTypes.D
    TE,1000);
    st.registerIndexTableOutParameter(16,100,OracleTypes.D
    TE,1000);
    st.execute();
    getting out params in arrays:
    java.sql.Date[]
    O_lSubFolder_CrOn=(java.sql.Date[])java.sql.Date[]
    st.getPlsqlIndexTable(15);
    O_lSubFolder_MdOn=(java.sql.Date[])st.getPlsqlIndexTab
    e(16);
    can anyone help me to solve this problem.1. Write a wrapper procedure that converts the table of dates to either number or date and then re-convert the table back into date.
    2. Since it's an out param you could create a temp table, insert the contents of the index by array into it and return a cursor.
    3. Create a oracle type using CREATE TYPE and then use an array of the type.
    David Rolfe
    Orinda Software

  • Best to use in terms of tuning Global Temporary table or PLSQL Table type

    Hi All,
    which one is best to use in terms of tuning Global Temporary table or PLSQL table type?
    Thanks in Advance.
    Regards
    Deepika

    user8828028 wrote:
    which one is best to use in terms of tuning Global Temporary table or PLSQL table type?The answer to which one is better depends on the requirements - and an informed decision as to which one to use to address those requirements.
    Thus it is important to understand how these work. They are nothing alike.
    PL/SQL collections reside in the PGA. Can only be used in SQL via binding. Cannot be indexed. Temp tables on the other hand does not use expensive PGA. Does not need to be bind in SQL. Can be indexed. Etc.
    Sure, a (surgical) saw and scalpel are both used on the operating table - but for very different purposes.

  • How to biod Crystal Reports based on ABAP Tables/Views

    Hi,
      Can any one post me some document stuff on building Crystal reports based on ABAP Tables/Views please!
    Thanks,
    Madhu.

    Hi,
    Check out the links below for Crystal Reports :
    Re: Crystal report in SAP BW
    http://support.businessobjects.com/documentation/product_guides/
    http://help.sap.com/saphelp_nw04/helpdata/en/86/06a8d3be17fc47aa8d850e50cf5f24/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/46/dfd33b1ed4b47de10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/34/c0523e83464644e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/0d/5f72b7c0e943d99f4f5cef2bfacfe1/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/06/00a63b60f26e3be10000000a114084/frameset.htm
    Hope this helps.
    Cheers,
    Kedar

  • How to retrieve values in XML into a plsql table type

    Hi
    I have an XML doc like below which is a Web Service response message.
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
    <GetOrgInput xmlns="http://www.example.org/ComplianceServices">
    <ProgramName>PgmA-PgmB</ProgramName>
    <ItemName>800 ADSL</ItemName>
    <Orgs>923</Orgs>
    <Orgs>1163</Orgs>
    <Orgs>1103</Orgs>
    </GetOrgInput>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    From the above doc you could see that i have multiple occurrences of "Orgs" element. Usually i am using the .extract and .getSTringVal() to retrieve the values as below.
    l_string_variable := p_response.doc.extract('//'||p_name||'/child::text()',p_namespace).getStringVal();
    But in this case if i do that, i am getting value as 92311631103. I need to get them into a table type of number. Pls advice me on how to achieve this.
    Thanks
    PKV

    I'm guessing this is a bug that Oracle fixed when 10.2 came out. I can reproduce your lack of results on 10.1.0.4 and as my post above shows, it works correctly on 10.2.0.4.
    Here's a modification to the script that shows what is going on as I was debugging this. (It took me a bit to realize the difference as it wasn't what I was expecting)
    declare
       p_response_doc XMLTYPE;
       l_new_doc      XMLTYPE;
    begin
       p_response_doc := XMLTYPE('<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <GetOrgOutput xmlns="http://www.example.org/ComplianceServices">
    <CompliantOrgs>1163</CompliantOrgs>
    <CompliantOrgs>1103</CompliantOrgs>
    </GetOrgOutput>
    </soapenv:Body>
    </soapenv:Envelope>');
       SELECT p_response_doc.extract('/*/*/*/CompliantOrgs','xmlns="http://www.example.org/ComplianceServices"')
         INTO l_new_doc
          FROM dual;
       dbms_output.put_line(l_new_doc.getStringVal());
       dbms_output.put_line('before loop');
       FOR r_rec IN (SELECT value(t) val
    --   FOR r_rec IN (SELECT extractvalue(value(t)
    --      , '/CompliantOrgs'
    --      , 'xmlns="http://www.example.org/ComplianceServices"' ) val
          -- BULK COLLECT INTO l_nm_array
          FROM TABLE(
            XMLSequence(
              p_response_doc.extract('/*/*/*/CompliantOrgs','xmlns="http://www.example.org/ComplianceServices"')
            ) t
       ) LOOP
          dbms_output.put_line(r_rec.val.getStringVal());
    --      dbms_output.put_line(r_rec.val);
       END LOOP;
       dbms_output.put_line('After output');
    end;On 10.2.0.4 this produces
    <CompliantOrgs xmlns="http://www.example.org/ComplianceServices">1163</CompliantOrgs>
    <CompliantOrgs xmlns="http://www.example.org/ComplianceServices">1103</CompliantOrgs>
    before loop
    <CompliantOrgs xmlns="http://www.example.org/ComplianceServices">1163</CompliantOrgs>
    <CompliantOrgs xmlns="http://www.example.org/ComplianceServices">1103</CompliantOrgs>
    After outputOn 10.1.0.4 it produces
    <CompliantOrgs xmlns="http://www.example.org/ComplianceServices">1163</CompliantOrgs>
    <Complian tOrgs xmlns="http://www.example.org/ComplianceServices">1103</CompliantOrgs>
    before loop
    <CompliantOrgs>1163</CompliantOrgs>
    <CompliantOrgs>1103</CompliantOrgs>
    After outputAs you can see, Oracle is removing (well technically not adding) the default namespace to the extracted nodes. To compensate, you need to change your loop to look like
       FOR r_rec IN (SELECT extractvalue(value(t)
          , '/CompliantOrgs') val
    --      , 'xmlns="http://www.example.org/ComplianceServices"' ) val
          -- BULK COLLECT INTO l_nm_array
          FROM TABLE(
            XMLSequence(
              p_response_doc.extract('//CompliantOrgs','xmlns="http://www.example.org/ComplianceServices"')
            ) t
       ) LOOPso that extractValue is not expecting any namespaces associated with the nodes.
    I would suggest you document this so you will know why things break if you upgrade to 10.2 or later at some point in the future.

  • Report based on  3 tables

    I am new to ABAP development
    I have 3 table, A905, A919 and KONP. Knumh field - condition record is common in both A905 and A919.
    common fields in A905 and A919 is VKORG, VTWEG , KSCHL,  KSCHL, REGIO . From A919 AUART_sd to be be displayed in the report with VKORG,VTWEG,KSCHL,REGIO, from A905 and knumh referrence from a905 and a919 to KONp-KNUMH.
    Following are the codes :But when executed the below codes data from A919 which has different condition reocrd is not getting displayed. But auart_sd is filled in the data that is executed from A905. Please help to make correction in the following  program.
    tables : A905,A919,KONP.
    TYPE-POOLS : slis.
    TYPES : begin of ty_A905,
      ALAND TYPE A905-ALAND,
      TaXK1 TYPE A905-TAXK1,
      TaxM1 TYPE A905-TAXM1,
      VKORG TYPE A905-VKORG,
      VTWEG TYPE A905-VTWEG,
      KONDM TYPE A905-KONDM,
      DATAB TYPE A905-DATAB,
      DATBI TYPE A905-DATBI,
      KAPPL TYPE A905-KAPPL,
      KSCHL TYPE A905-KSCHL,
      MWSK1 Type konp-MWSK1,
      ALAND1 TYPE A919-ALAND,
      TaXK2 TYPE A919-TAXK1,
      TaxM2 TYPE A919-TAXM1,
      VKORG1 TYPE A919-VKORG,
      VTWEG1 TYPE A919-VTWEG,
      KONDM1 TYPE A919-KONDM,
      DATAB1 TYPE A919-DATAB,
      DATBI1 TYPE A919-DATBI,
      KAPPL1 TYPE A919-KAPPL,
      KSCHL1 TYPE A919-KSCHL,
      MWSK2 Type konp-MWSK1,
      knumh TYPE A919-knumh,
      AUART_sd TYPE A919-auart_sd,
      wkreg1 TYPE a919-wkreg,
      regio1 TYPE a919-regio,
      image TYPE c,
      END OF ty_a905.
      DATA : it_display TYPE TABLE OF ty_A905 WITH HEADER LINE.
      DATA : it_display1 TYPE TABLE OF ty_A905 WITH HEADER LINE.
      DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
             wa_fieldcat TYPE slis_fieldcat_alv.
      DATA :   w_ssfctrlop TYPE ssfctrlop,
               w_func TYPE rs38l_fnam ,
               w_doinfo TYPE ssfcrespd ,
               w_opinfo TYPE ssfcrescl ,
               w_joopt  TYPE ssfcresop .
    DATA : w_no_of_lines TYPE int4.
    SELECT-OPTIONS :
                      so_KAPPL FOR A905-KAPPL,
                      so_kschl FOR A905-kschl,
                      so_VKORG FOR A905-VKORG,
                      so_VTWEG FOR A905-VTWEG,
                      so_kondm FOR A905-kondm,
                      so_wkreg FOR A919-wkreg.
    START-OF-SELECTION.
    SELECT   A905~VKORG
             A905~KAPPL
             A905~kschl
             A905~VTWEG
             A905~KONDM
             A905~DATAB
             A905~DATBI
             A905~ALAND
             A905~TaxK1
             A905~TaxM1
             A905~KNUMH
             A919~AUART_SD
             A919~VKORG
             a919~VTWEG
             KONP~MWSK1
             KONP~KNUMH
        INTO CORRESPONDING FIELDS OF TABLE it_display from a905
        INNER JOIN a919 on a905~kschl = a919~kschl
        INNER JOIN konp on a905~knumh = konp~knumh
         where a905~kappl in so_kappl
         and a905~kschl in so_kschl
         and a905~VKORG in so_vkorg
         and a905~vtweg in so_vtweg
         and a905~kondm in so_kondm
         and a905~wkreg in so_wkreg.

    are you sure your data meets the JOIN conditions?
    You can make a quick check.. only example...
    select single * from KONP into ls_konp
    where knumh = P_knumh.
    if sy-subrc eq 0.
    select * from from A905 into table lt_a905 where
         kappl in so_kappl
         and kschl in so_kschl
         and VKORG in so_vkorg
         and vtweg in so_vtweg
         and kondm in so_kondm
         and wkreg in so_wkreg
         and knumh = ls_konp-knumh.
    if sy-subrc eq 0.
    select * from A919 into table lt_a919
    for all entries in lt_a905
    where kappl = lt_a905-kappl
    and kschl = lt_905-kschl
    and knumh = lt_905-knumh.
    endif.
    endif.

  • Sorting on two reports based on same table

    Hi,
    I have two reports on the same page, that show rows from a table.
    Each table has a different condition, so that there is no overlapping rows.
    The problem i have run into, is that i have enabled sort on the columns in both reports - there are instances when there are no rows shown in one of the reports.
    when i click on a column name to sort on that column, i get the error
    failed to parse SQL query:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    in the report that shows no values. i understand what the error means, but am having some trouble finding a way of solving it.
    any help would be much appreciated!

    Look here:
    Column sort gives "failed to parse SQL query"
    Denes Kubicek

  • Transporting Crystal report based on ECC table

    Hi guys
    We use CR 2011 over a table in ECC DEV
    Is there an option to transport the report to our production system without having to recreate it?
    Regards
    Shlomi

    Hi Shlomi,
    Yes, you need to 'set the datasource location' of the report to the Production System.
    Go to Database > Set Datasource Location and change the source.
    Hope this helps!
    -Abhilash

  • Creating variable of type of a PLSQL table type

    I have an object defined as
    create or replace type emp_rec as object (col1 date, col2 date);
    then I defined
    create or replace type data_emp_rec is table of emp_rec;
    Now I need to define a variable temp_rec which will host data returned of emp_rec structure.
    please advise how to define a variable to have data structure similar to that of emp_rec
    declare
    temp_rec emp_rec(null, null);
    or
    temp_rec data_emp_rec;
    Thx

    Hello
    It's all about casting data types and supplying the right data type to the bulk collect clause:
    SQL> SELECT
      2     usr.nm,
      3     perm.id,
      4     perm.descr
      5  FROM
      6     dt_test_user usr,
      7     dt_test_permission perm,
      8     dt_test_user_permission usr_perm
      9  WHERE
    10     usr.id = usr_perm.user_id
    11  AND
    12     perm.id = usr_perm.permission_id
    13  ORDER BY
    14     usr.nm
    15  /
    NM                                     ID DESCR
    Barry Bethel                            4 Be very enthusiastic about everything
    Barry Bethel                            2 Advertise slimming products
    Dr. Evil                                1 Take over the world
    Rolf Harris                             4 Be very enthusiastic about everything
    Rolf Harris                             3 Sing very strange songs
    SQL> select
      2     usr.id,
      3     usr.nm,
      4     CURSOR(select
      5                             p.user_id
      6                     from
      7                             dt_test_user_permission p
      8                     where
      9                             p.user_id = usr.id
    10                     ) pos_cursor
    11  from
    12     dt_test_user usr
    13  /
            ID NM                             POS_CURSOR
             1 Rolf Harris                    CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
       USER_ID
             1
             1
             2 Barry Bethel                   CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
       USER_ID
             2
             2
             3 Dr. Evil                       CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
       USER_ID
             3
    SQL> select
      2     usr.id,
      3     usr.nm,
      4     CAST(MULTISET(  select
      5                                                             p.user_id
      6                                                     from
      7                                                             dt_test_user_permission p
      8                                                     where
      9                                                             p.user_id = usr.id
    10                                             ) AS permissionList
    11                             ) pos_ntt
    12  from
    13     dt_test_user usr
    14  /
            ID NM                             POS_NTT(ID)
             1 Rolf Harris                    PERMISSIONLIST(PERMISSION_TYPE(1), PERMISSION_TYPE
                                              (1))
             2 Barry Bethel                   PERMISSIONLIST(PERMISSION_TYPE(2), PERMISSION_TYPE
                                              (2))
             3 Dr. Evil                       PERMISSIONLIST(PERMISSION_TYPE(3))
    SQL> declare
      2     ul userList;
      3  begin
      4     select
      5             usr.id,
      6             usr.nm,
      7             CAST(MULTISET(  select
      8                                                     p.user_id
      9                                             from
    10                                                     dt_test_user_permission p
    11                                             where
    12                                                     p.user_id = usr.id
    13                                     ) AS permissionList
    14                     ) pos_ntt
    15     bulk collect into
    16             ul
    17     from dt_test_user
    18             usr;
    19  end;
    20  /
            from dt_test_user
    ERROR at line 17:
    ORA-06550: line 17, column 2:
    PL/SQL: ORA-00947: not enough values
    ORA-06550: line 4, column 2:
    PL/SQL: SQL Statement ignored
    SQL> declare
      2     ul userList;
      3  begin
      4     select
      5             user_type(      usr.id,
      6                                     usr.nm,
      7                                     CAST(MULTISET(  select
      8                                                                             p.user_id
      9                                                                     from
    10                                                                             dt_test_user_permission p
    11                                                                     where
    12                                                                             p.user_id = usr.id
    13                                                             ) AS permissionList
    14                                             )
    15                             )
    16     bulk collect into
    17             ul
    18     from dt_test_user
    19             usr;
    20
    21  end;
    22  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2     ul userList;
      3  begin
      4     select
      5             user_type(      usr.id,
      6                                     usr.nm,
      7                                     CAST(MULTISET(  select
      8                                                                             p.user_id
      9                                                                     from
    10                                                                             dt_test_user_permission p
    11                                                                     where
    12                                                                             p.user_id = usr.id
    13                                                             ) AS permissionList
    14                                             )
    15                             )
    16     bulk collect into
    17             ul
    18     from dt_test_user
    19             usr;
    20
    21     FOR li_Idx IN ul.FIRST..ul.LAST LOOP
    22
    23             dbms_output.put_line(ul(li_Idx).name);
    24
    25             FOR li_NttIdx IN ul(li_Idx).permissions.FIRST..ul(li_Idx).permissions.LAST LOOP
    26
    27                     dbms_output.put_line(ul(li_Idx).permissions(li_NttIdx).id);
    28
    29             END LOOP;
    30
    31     END LOOP;
    32
    33  end;
    34  /
    Rolf Harris
    1
    1
    Barry Bethel
    2
    2
    Dr. Evil
    3
    PL/SQL procedure successfully completed.HTH
    David

  • Report based on fact tables that don't have the same dimensionality

    Hi all
    I want to combine in the same report different measures from different fact tables that doesn't have the same dimensionality,for example:
    measure 1 linked to dimensions : time geography and product
    measure 2 linked to dimensions : time and geography
    Currenctly when I create a report like:
    time----gepgraphy---product------measure 1-----measure 2 I don't have any data for measure2 because it's not linked to the product dimension.
    The exact report is year---store name---product area name----- store sales-----number of visitors : the number of vistors doesn't have any relation with the product dimension.
    Is there a way to create this kind of report??
    Regards

    Don't take this the wrong way guys, but I feel compelled to say this before the answers start coming in:
    This issue had been discussed already many times. Stijn, John, Kishore etc. have all answered this question for the one or the other user. This forum has a search functionality for a reason. To first look for information and then ask your question. Why wait - potentially - a couple of hours for an answer that's one search away?
    Seriously people. It's not like forums magically appeared in 2k7...they've been around for quite a while now and netiquette and common sense with regards to posting should become normal.
    Cheers,
    C.

  • Report based on PLSQL returning SQL query

    I created function which builds the SQL and returns it as VARCHAR2. For testing purposes I harcoded the primary ID for the query to be based on. I run the function as standalone call to get the generated SQL and to test it. It works fine. The moment I try to use the ID parameter as an argument passed to the function it doesn't work and I get the "No data found" error. Again if I try this function outside of Apex it produces correct SQL syntax and it runs.
    The function signature is really simple:
    FUNCTION abc(i_id NUMBER) RETURN VARCHAR2
    IS
    l_id NUMBER;
    BEGIN
    -- this works:
    -- l_id := 300;
    -- this doesn't work:
    l_id := i_id;
    ... more code follows. It uses the l_id while building the query.
    I also tried to make it an anonymous block and place it directly in Apex region. Again I face the same problem. I modified this function slightly to reference the page attribute instead of accepting parameter:
    DECLARE
    l_id NUMBER;
    BEGIN
    -- this works:
    -- l_id := 300;
    -- this doesn't work:
    l_id := :P65_ID;

    Have you verified that i_id and P65_ID have a value when the procedure runs? Perhaps have something along the lines of "if i_id is null then return 'select <dummy data> from dual' else [build real query here]"...?
    -D.

  • Generating an  html report based on table at sql 2005 db

    Hi
    I want to create an html report based on a table named inventory on sql server 2005 database.
    first code used to generate an output report
        try {
                // TODO add your handling code here:
                String s = "<html> <body> <table border=1><caption> Inventory Report </caption>";
                s += "<tr><td>Item_id<td>item_name<td>Existing quantity</td><tr><td>3<td>4<td> <td>";
                byte[] sb = s.getBytes();
                FileOutputStream fs = null;
                try {
                    fs = new FileOutputStream("D:\\Report\\Report.html");
                } catch (FileNotFoundException ex) {
                    Logger.getLogger(mileshframe.class.getName()).log(Level.SEVERE, null, ex);
                fs.write(sb);
                fs.close();
            } catch (IOException ex) {
                Logger.getLogger(mileshframe.class.getName()).log(Level.SEVERE, null, ex);
    Second jdbc  code for connection and select all records in the table
    try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                 con = DriverManager.getConnection("jdbc:odbc:MerchandiseCon","sa","sql123#");
                st = con.createStatement( );
    ResultSet rset=st.executeQuery("Select Item_code,Item_Name,item_cost,item_quantity  from Inventory");
         String s="";
    while(rset.next())
        s+=(rset.getString(1)+"\t\t"+rset.getString(2)+"\t"+rset.getString(3)+"\t"+rset.getString(4)+"\n");
          st.close();
                con.close();
         catch(ClassNotFoundException ex)
             ex.printStackTrace();
          catch(SQLException ex)
             ex.printStackTrace();
            }                             I want someone helps me to merge two codes into one code to generate an output html report.
    thanks in advance

    This is my trial but not the desired result ,it's displayed the title and a line only
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            // TODO add your handling code here:
                          String s = "<html> <body> <table border=1> <caption>Report title</caption>";
                byte[] sb = s.getBytes();
                FileOutputStream fs = null;
                try {
                // TODO add your handling code here:
                try {
                    fs = new FileOutputStream("D:\\Report\\myeport.html");
                } catch (FileNotFoundException ex) {
                    Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
                fs.write(sb);
                fs.close();
            } catch (IOException ex) {
                Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
                try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                 con = DriverManager.getConnection("jdbc:odbc:MerchandiseCon","sa","sql123#");
                st = con.createStatement( );
    ResultSet rset=st.executeQuery("Select Item_code,Item_Name,item_cost,item_quantity  from Inventory");
    while(rset.next())
                   s+=("<tr><td>"+rset.getString("Item_Code")+"</td><td>"+rset.getString("Item_Name")+"</td><td>"+rset.getString("item_cost")+"</td><td>"+rset.getString("item_quantity")+"</td></tr>");
                try {
                // TODO add your handling code here:
                try {
                    fs = new FileOutputStream("D:\\Report\\myeport.html");
                } catch (FileNotFoundException ex) {
                    Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
                fs.write(sb);
                fs.close();
            } catch (IOException ex) {
                Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
         st.close();
                con.close();
         catch(ClassNotFoundException ex)
             ex.printStackTrace();
          catch(SQLException ex)
             ex.printStackTrace();
        }

  • Report based on Object Types

    Hi All,
    I am using Oracle 9i & Developer 6i on Windows platform in client/server environment. I created a report based on an Object Type defined in the Database. I am facing two problems in that:
    1. Its not picking up Date columns properly. When I run the report, I receive error: "REP-0612: Invalid Date Mask.
    ORA-01801: date format is too long for internal buffer.".
    When I checked, I noticed that all the date columns in my Data Model, which are coming from Object Type are of Width 9 only. I want to ask how is it so, & how can I sort it out. I have not specified any format model for dates neither in Object Type nor in Report anywhere.
    2. Another thing is, after reopening the report, in the report builder, i mean closing & then opening the .rdf file, when I try to run the report, I receive following error: "REP-0499: Column 'Column_Name' selected by the query is incompatible with report defination". This column is one of the columns/attributes of the object type on which my report is based. Though, nothing has been changed in the object type or any other database object, it gives this error, everytime, I try to run the report, after closing it(after proper saving) & opening it again. Can anyone help me by telling, why is it happening like this.
    Thanks in Advance,
    Inderjeet Singh

    Thanks for the quick reply InoL,
    I'm not familiar with breakOrder, however when I review the code behind the report, I see nothing but:
    breakOrder="none" in several lines. There is no other value other than "none" for this setting. Here's an excerpt:
    "Group Name" breakOrder="none".
    What exactly does breakOrder control and what other values are possible?
    As far as pageProtect goes, there are two entries that show:
    <generalLayout pageProtect="yes" verticalElasticity="variable"/>
    Is it worth a shot to change both to "no" to see what happens?
    Thanks,
    Dave

  • Report from PL/SQL Table

    Thanks for answer to my first question. Now I have another problem.
    Is there any way to print a report based on virtual table, which is created during some Pl/SQL procedure and can't be easily decribed by Select statement

    SELECT FROM PL/SQL TABLE IN ORACLE REPORTS 6I
    The requirement is to populate a table and then select from that table in a report. The typical solution is to
    populate a database table, but for situations where that is undesirable there is a way to select from a PL/SQL
    table.
    For example - for each employee we want to populate a PL/SQL table and then select from that table.
    I used the following records in the emp table:
    INSERT INTO Emp VALUES(123,'Bob','Sales',555,'28-JAN-79',35000,12,30);
    INSERT INTO Emp VALUES(321,'Sue','Finance',555,'12-MAY-83',42000,12,10);
    INSERT INTO Emp VALUES(234,'Mary','Account',555,'14-AUG-82',33000,12,20);
    INSERT INTO Emp VALUES(623,'Joe','Sales',555,'28-JAN-79',35000,12,30);
    INSERT INTO Emp VALUES(621,'Jim','Finance',555,'12-MAY-83',42000,12,10);
    INSERT INTO Emp VALUES(634,'Jane','Account',555,'14-AUG-82',33000,12,20);
    INSERT INTO Emp VALUES(723,'Fred','Sales',555,'28-JAN-79',35000,12,30);
    INSERT INTO Emp VALUES(721,'Meg','Finance',555,'12-MAY-83',42000,12,10);
    INSERT INTO Emp VALUES(734,'Jill','Account',555,'14-AUG-82',33000,12,20);
    =============================================================================================
    Step 1: Create a package spec in the report:
    PACKAGE pkg_table IS
    TYPE t_rec IS RECORD (
    field1 NUMBER(6),
    field2 VARCHAR2(30));
    TYPE t_tab IS TABLE OF t_rec INDEX BY BINARY_INTEGER;
    gv_tab t_tab;
    FUNCTION populate (
    p_empno NUMBER) RETURN NUMBER;
    END;
    Step 2: Create the package body:
    PACKAGE BODY pkg_table IS
    FUNCTION populate (
    p_empno NUMBER) RETURN NUMBER IS
    BEGIN
         gv_tab.DELETE;
         -- populate table as required - for demo purposes put in anything
         FOR lv_ind IN 1..MOD(p_empno,20) LOOP
              gv_tab(lv_ind).field1 := lv_ind;
              gv_tab(lv_ind).field2 := 'row '||TO_CHAR(lv_ind)||' for emp '||TO_CHAR(p_empno);
         END LOOP;
         RETURN gv_tab.COUNT;
    END populate;
    END;
    Step 3: Create the master query:
    SELECT empno,
    ename
    FROM emp
    Step 4: Add a formula column CF_populate to the master query that does:
    function CF_populateFormula return Number is
    -- for each emp fetched this formula will repopulate the PL/SQL table
    -- and return the number of records in the table
    begin
    return pkg_table.populate(:empno);
    end;
    Step 5: Create the detail query:
    -- we need to join this to the master and then ensure that for each
    -- empno there are as many records fetched as there will be
    -- records in the PL/SQL table
    SELECT e1.empno,rownum
    FROM emp e1, emp e2, emp e3
    WHERE rownum <= :CF_populate
    Step 6: Add formula columns to the detail query for each of the fields in the
    PL/SQL table we want to display:
    CF_Field1:
    function CF_field1Formula return Number is
    begin
    return pkg_table.gv_tab(:rownum).field1;
    end;
    CF_Field2:
    function CF_field2Formula return Varchar2 is
    begin
    return pkg_table.gv_tab(:rownum).field2;
    end;
    Step 7: Create the repeating frame and layout items to display the formula columns.
    =============================================================================================
    The same technique can be used to populate a master query. In a report level formula column
    CF_Populate populate the PL/SQL table as required. In the master query we just need the rownum:
    SELECT rownum
    FROM emp, emp, emp
    WHERE rownum <= :CF_Populate
    Add the formula columns to display Field1 and Field2.
    =============================================================================================
    Hugh Nelson
    26/04/2005

  • Crystal Report linked to a table with filter attached

    I have a Crystal Report based on 2 tables and I want it to display every incident in the incident table and to pull the truckID of the
    first truck on the scene from the truck table . So the finished product should look like this…
    IncidentID           IncidentNum     ResponseTime                  First Arriving Truck           Disctict
      1x44452                1258ab55             5:32                                        B8                              2
    *The first arriving truck is the truck in the Truck Table with the same IncidentID and  the earliest ArrivalTime.  There will be multiple trucks for each incident but I want it to only show the one that arrived first (ArrivalTime).  So one line per incidentID.
    Incident Table
    IncidentID
    IncidentNum
    ResponseTime
    District
    Truck Table (Will contain many trucks for one incident with the following info
    Truckkey
    IncidentID (Link to Incident Table)
    ArrivalTime
    TruckID
    I figure I probably need to build a formula with the min function or perhaps an OnCommand – I’m just not sure.
    The biggest issue is the overall report has 4 filter settings.  They can select a date range, a location, an incident type and a range for the response time. So I do this with the Select Expert
    I can get all of that to work except I cannot figure out how to get it to pull the First Arriving Truck without duplicating the incident
    line.  Also, if there is a Truck with an ArrivalTime of Null I want it to ignore that Truck Table record.
    Can anyone help???

    Hi Debbie,,
    You may try this:
    1) Go to the Group Expert > Create a Group on the 'Incident ID' field from the Incident Table
    2) Insert a summary on the 'Arrival Time' field and place the field on the Group Footer
    3) Move all the fields from the Details section to the Group Footer
    4) Go to the Group Selection Formula (Report > Selection Formulas > Group) and use this code:
    {Truck.ArrivalTime} = Minimum({Truck.ArrivalTime}, {Incident ID})
    5) Suppress the Details Section
    -Abhilash

Maybe you are looking for

  • Xp_logininfo Installation problem

    Hello gurus, I'm facing the same problem as described in this link: Re: xp_logininfo "Installation problem on windows 2003 with Sql 2005" the error I get is similiar: <i>The below message comes from executing the command master..xp_logininfo '<domain

  • Error in tdms scrambling activity

    Hi, I am running a scenario for tdms HCM. I got this below error while running Define Scrambling Rules (optional) activity. Syntax error in customer code rule Message no. CNV_TDMS_HCM110 Central/Control system here is Solution Manager. I have selecte

  • EJB deployed but doesnt show up in JNDI tree on weblogic

    Hi, I have a sample EJB deployed on weblogic 10.3 server. My Bean class contains following code. ======================================================================== @Stateless (mappedName = "DemoEJB") @TransactionManagement(TransactionManagement

  • PNG for a WEB: "None/Fast" or "Smallest/Slow"?

    I need to do for a WEB many PNG icons (aprox. 70x70 pixels e/a). There will be like 20 of them loaded in the WEB at the same time. PLEASE, which kind of compression I should pick when I save as a PNG: "None/Fast" or "Smallest/Slow", and "Interlaced"

  • Performance test from unit tests

    Hi; I tried to apply the principle TDD at the level of perf test of an J2ee application and this from units tests. I thus used the tool JUnitPerf but regrettably with this tool I must to modify my unit test for the update of the sequence of a test an