Need help in 4 quires below

Find the comapany with higest salary in 2008
Edited by: 809889 on Nov 12, 2010 10:05 AM

a) you haven't provided your database version
b) you haven't formatted your code using {noformat}... put code here ... {noformat} tags.
c) it looks like a homework question. People don't like doing other peoples homework for them.
d) it doesn't look like you've attempted to answer the questions yourself, hence we don't know what your issue is in doing so.
When you've provided the correct information in the correct format and shown us that you've had a go yourself, but you've having problems for some reason then people may choose to help you.

Similar Messages

  • Need Help in Getting the below output

    Hi All,
    The below is the table data.
    col1     col2     col3     col4     col5     col6
    Aa     1     Con     100     10     -1
    Ba     2     Cam     50     2     33
    Aa     1     Con     200     20     -2
    Ca     3     val     2     5     -10
    Aa     1     Con     150     30     -3
    Ba     2     Cam     20     3     11
    Ca     3     val     3     5     -20
    Ba     2     Cam     30     5     22
    Ca     3     val     5     4     -30
    I need the output as below. Please help me in getting the output.
    col1     col2     col3     col4     col5     col6
    Aa     1     Con     100     10     -1
    Aa     1     Con     200     20     -2
    Aa     1     Con     150     30     -3
    Aa-Con Subtotal          450     60     -6
    Ba     2     Cam     20     3     11
    Ba     2     Cam     30     5     22
    Ba     2     Cam     50     2     33
    Ba-Cam Subtotal          100     10     66
    Ca     3     val     2     5     -10
    Ca     3     val     3     5     -20
    Ca     3     val     5     4     -30
    Ca-val Subtotal          10     14     -60
    I am using Oracle 10g. Let me know if other details required.
    Thanks in Advance.
    Regards,
    Ravi Kumar Ankarapu.

    You can try using ROLLUP and GROUPING SETS like how some of the other forum members have suggested. Another way of getting the desired output would be :
    with t as
    select 'Aa' col1, 1 col2, 'Con' col3, 100 col4, 10 col5, -1 col6 from dual
    union all
    select 'Ba', 2, 'Cam', 50, 2, 33 from dual
    union all
    select 'Aa', 1, 'Con', 200, 20, -2 from dual
    union all
    select 'Ca', 3, 'val', 2, 5, -10 from dual
    union all
    select 'Aa', 1, 'Con', 150, 30, -3 from dual
    union all
    select 'Ba', 2, 'Cam', 20, 3, 11 from dual
    union all
    select 'Ca', 3 ,'val', 3, 5, -20 from dual
    union all
    select 'Ba', 2, 'Cam', 30, 5, 22 from dual
    union all
    select 'Ca', 3, 'val', 5, 4, -30 from dual
    select * from
        select * from t
        union all
        select distinct * from
            select col1 || '-' || col3 || ' Sub-total' col1, null col2, null col3,
            sum(col4) over (partition by col1 order by col1) col4,
            sum(col5) over (partition by col1 order by col1) col5,
            sum(col6) over (partition by col1 order by col1) col6
            from t
    order by col1, col2, col3
    Output:
    "COL1"     "COL2"     "COL3"     "COL4"     "COL5"     "COL6"
    "Aa"     "1"     "Con"     "150"     "30"     "-3"
    "Aa"     "1"     "Con"     "100"     "10"     "-1"
    "Aa"     "1"     "Con"     "200"     "20"     "-2"
    "Aa-Con Sub-total"     ""     ""     "450"     "60"     "-6"
    "Ba"     "2"     "Cam"     "50"     "2"     "33"
    "Ba"     "2"     "Cam"     "20"     "3"     "11"
    "Ba"     "2"     "Cam"     "30"     "5"     "22"
    "Ba-Cam Sub-total"     ""     ""     "100"     "10"     "66"
    "Ca"     "3"     "val"     "5"     "4"     "-30"
    "Ca"     "3"     "val"     "2"     "5"     "-10"
    "Ca"     "3"     "val"     "3"     "5"     "-20"
    "Ca-val Sub-total"     ""     ""     "10"     "14"     "-60"

  • Need help in resolving the below error - SQL statement to execute cannot be

    Here is my CO as below , which creates a callable statement.
    try {
    OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
    OADBTransactionImpl t = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
    OracleCallableStatement proc = (OracleCallableStatement)t.createCallableStatement(lquery, -1);
    proc.execute();
    t.commit();
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    After running the page , getting the below error ... ( Please find the below error stack )
    I reffered the developement guide but did not get helpful things.
    Please provide me any clues on the same.
    Regards Raghu
    -- Error Stack ---------------------------------------------------------
    Error Page
    Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27123: SQL error during call statement preparation. Statement: null
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    java.sql.SQLException: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    Edited by: Raghu on Sep 14, 2010 2:58 AM

    check the code pasted by me again
    Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
    Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right oneThanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • NEED HELP WITH WORKFLOW CONFIGURATION

    I need help with 3 situations below. Please help me with these. How do I configure these. I also haveto provide specs to the Abaper. What exactly do I need to include in the specs. I anyone has the specs similar to these please send me over. Also tell me what I need to do to get these requirements fulfilled.
    1)  Description:
    This is a workflow requirement to serve as a reminder of upcoming investment
    maturities.
    Requirements Details:
    Create a workflow to serve as a reminder of upcoming investment maturities.
    Donor System Processing Narrative:
    Read the maturity dates on investments.
    Target System Processing Narrative:
    Send a notice to the parties that an investment will be maturing soon.
    2)  Description:
    Implement workflow to route invoice receipts using a one time vendor for management
    review and posting
    Desired Functionality:
    If a one time vendor is entered by the AP Voucher Clerk the invoice will be automatically
    parked by the program and a workflow notification triggered to the Accounting
    Supervisor and Accounting Manager (backup). The Accounting Supervisor will review
    the parked document and imaged copy of the actual invoice and post the parked
    document.
    3)  Description:
    An approval workflow is needed for credit memos posted to SAP customer accounts.
    Desired Functionality:
    The Cash Journal Clerk will post a credit memo to the customer account using transaction
    FV75 Park Customer Invoice. This transaction will automatically trigger a workflow to
    the Accounting Manager for approval and then to the CFO who will approve and post the
    parked document. (In order for this transaction to automatically trigger what configuration needs to be done).

    Bob;
    You can borrow the example code that ships with both NI-DAQ (in case you are doing NI-DAQ function calls) and Labview. The best examples to start with are the ones that have the prefix STC.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Need help to optimize query

    Hi
    I need help to optimize the below query.... I takes to long to execute.
    SELECT  vbak~waerk
                  vbapvbeln vbapposnr
                  vbapnetwr vbapbrgew vbap~erdat
            INTO CORRESPONDING FIELDS OF TABLE tmp_orders
            FROM vbak INNER JOIN vbap ON vbakvbeln = vbapvbeln
            WHERE vbap~matnr EQ t_mchb-matnr
            AND vbap~netwr   GT 0            
            AND vbap~brgew   GT 1                             
            AND vbak~auart     IN ('ZCAO', 'ZDDO').   
    Please help...
    Edited by: Alvaro Tejada Galindo on Mar 18, 2008 6:02 PM

    Hi,
    try this logic and see:
    data: begin of itab_for_vbak occurs 0,
          waerk type WAERK,
          vbeln type vbeln,
          end of itab_for_vbak,
          wa_for_vbak like itab_for_vbak.
    data: begin of itab_for_vbap occurs 0,
          vbeln like vbap-VBELN,
          posnr like vbap-POSNR,
          netwr like vbap-NETWR,
          brgew like vbap-brgew,
          erdat like ERDAT
          end of itab_for_vbap,
          wa_for_vbap like itab_for_vbap.
    SELECT
    waerk
    vbeln
    from
    vbak
    into table itab_for_vbak
    where
    vbak~auart IN ('ZCAO', 'ZDDO').
    select
    vbeln
    posnr
    netwr
    brgew
    erdat
    into table itab_for_vbap
    where
    vbap~matnr EQ t_mchb-matnr
    AND vbap~netwr GT 0
    AND vbap~brgew GT 1.
    loop at itab_for_vbak into wa_for_vbak.
    read table itab_for_vbap with key vbeln = wa_for_vbak-vbeln.
    if sy-subrc eq 0.
    tmp_orders-waerk = wa_for_vbak-waerk.
    tmp_orders-vbeln = wa_for_vbap-vbeln.
    tmp_orders-posnr = wa_for_vbap-posnr.
    tmp_orders-brgew = wa_for_vbap-brgew.
    tmp_orders-erdat = wa_for_vbap-erdat.
    append tmp_orders.
    endif.
    endloop.
    Please let me know how it has improved your performance or still if you have issues on this.
    Thanks,
    Vishnu.

  • Need help th tuning query or re write the query--

    Hi,
    Need help to tune the below query or rewrite th query for reducing the execution time Please find the query and explain plan.
    QUERY
    explain plan FOR SELECT consumer_key,product_key,days_in_product,20100201 period_key FROM
    (SELECT consumer_key,
      product_key,
      days_in_product,
      row_number() over ( Partition BY consumer_key order by Days_in_product DESC) row_num
    FROM
      (SELECT consumer_key,
        product_key,
        SUM(no_ofdays) days_in_product
      FROM
        (SELECT pcv.consumer_key,
          pcv.product_key,
          pcv.product_consumer_valid_from,
          pcv.product_consumer_valid_to,
          DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from) period_start,
          DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959) period_end,
          CASE
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) BETWEEN 20100201000000 AND 20100228235959
            AND activation_date > to_Date(product_consumer_valid_to,'YYYYMMDDHH24MISS')
            THEN 0
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) BETWEEN 20100201000000 AND 20100228235959
            AND activation_date BETWEEN to_Date(product_consumer_valid_from,'YYYYMMDDHH24MISS') AND to_Date(product_consumer_valid_to,'YYYYMMDDHH24MISS')
            THEN
              --to_char(activation_date,'MON-YYYY')='PERIOD_ACTIVE'  and activation_date >= to_Date(product_consumer_valid_from,'YYYYMMDDHH24MISS') then
              (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_date(TO_CHAR(activation_date,'YYYYMMDDHH24MISS'),'YYYYMMDDHH24MISS') )
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) < 20100201000000
            THEN (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_Date(DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from),'YYYYMMDDHH24MISS') )
            WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) > 20100228235959
            THEN 0
            ELSE
              --unusual situation
              (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_Date(DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from),'YYYYMMDDHH24MISS') )
          END No_ofDays
        FROM cimtran.product_consumer_validity pcv,
          consumer_dimension cd
        WHERE pcv.consumer_key           =cd.consumer_key
        AND product_consumer_valid_to   >= 20100201000000
        AND product_consumer_valid_from <= 20100228235959
          --and product_consumer_valid_from > '20090801000000'
        ORDER BY consumer_key,
          product_key,
          product_consumer_valid_from
        ) a
      GROUP BY consumer_key,
        product_key
      ORDER BY consumer_key,
        product_key
    ) WHERE row_num=1 ;EXPLAIN PLAN
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 3823907703"
    "| Id  | Operation                | Name                      | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
    "|   0 | SELECT STATEMENT         |                           |  4665K|   231M|       |   133K  (1)| 00:31:08 |"
    "|*  1 |  VIEW                    |                           |  4665K|   231M|       |   133K  (1)| 00:31:08 |"
    "|*  2 |   WINDOW SORT PUSHED RANK|                           |  4665K|   173M|   232M|   133K  (1)| 00:31:08 |"
    "|   3 |    VIEW                  |                           |  4665K|   173M|       |   104K  (1)| 00:24:18 |"
    "|   4 |     SORT GROUP BY        |                           |  4665K|   182M|   729M|   104K  (1)| 00:24:18 |"
    "|*  5 |      HASH JOIN           |                           |    13M|   533M|    65M| 44241   (1)| 00:10:20 |"
    "|   6 |       TABLE ACCESS FULL  | CONSUMER_DIMENSION        |  2657K|    35M|       |  4337   (1)| 00:01:01 |"
    "|*  7 |       TABLE ACCESS FULL  | PRODUCT_CONSUMER_VALIDITY |    13M|   351M|       | 15340   (2)| 00:03:35 |"
    "Predicate Information (identified by operation id):"
    "   1 - filter(""ROW_NUM""=1)"
    "   2 - filter(ROW_NUMBER() OVER ( PARTITION BY ""CONSUMER_KEY"" ORDER BY "
    "              INTERNAL_FUNCTION(""DAYS_IN_PRODUCT"") DESC )<=1)"
    "   5 - access(""PCV"".""CONSUMER_KEY""=""CD"".""CONSUMER_KEY"")"
    "   7 - filter(""PRODUCT_CONSUMER_VALID_FROM""<=20100228235959 AND "
    "              ""PRODUCT_CONSUMER_VALID_TO"">=20100201000000)"

    I doubt that this query can be tuned without using indexes. There is a lot of unnecessary work specified in your query, like unnecessary intermediate sorting and selecting unused columns. The cost based optimizer recognized it and skips some of that unnecessary work, it seems. For clarity's sake, I would rewrite your query like below. Note that the query is untested:
    select consumer_key
         , max(product_key) keep (dense_rank last order by days_in_product) product_key
         , max(days_in_product) days_in_product
         , 20100201 period_key
      from ( select pcv.consumer_key
                  , pcv.product_key
                  , sum
                    ( case
                      when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) between 20100201000000 and 20100228235959
                      then
                        case
                        when cd.activation_date > to_date(pcv.product_consumer_valid_to,'yyyymmddhh24miss')
                        then
                          0
                        when cd.activation_date between to_date(pcv.product_consumer_valid_from,'yyyymmddhh24miss') and to_date(product_consumer_valid_to,'yyyymmddhh24miss')
                        then
                          to_date(to_char(pcv.product_consumer_valid_to),'yyyymmddhh24miss'))
                          - to_date(to_char(activation_date,'yyyymmddhh24miss'),'yyyymmddhh24miss')
                        end
                      when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) < 20100201000000
                      then
                        to_date(to_char(pcv.product_consumer_valid_to),'yyyymmddhh24miss'))
                        - to_date(to_char(pcv.product_consumer_valid_from),'yyyymmddhh24miss'))
                      when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) > 20100228235959
                      then
                        0
                      end
                    ) days_in_product
               from cimtran.product_consumer_validity pcv
                  , consumer_dimension cd
              where pcv.consumer_key             = cd.consumer_key
                and product_consumer_valid_to   >= 20100201000000
                and product_consumer_valid_from <= 20100228235959
              group by consumer_key
                  , product_key
    group by consumer_keyRegards,
    Rob.

  • Need to restart the technical help desk as listed below.  How do we make this happen.  The Technician was about to link into my desk top when we ended about 4 hours ago.

    Thank you for contacting Adobe. @
    A representative will be with you shortly.
    Thank you for your patience.
    While you wait, you can try our community forums where experts are available 24 hours a day, 7 days a week.
    You are now chatting with Naveen Kumar.
    Naveen Kumar: Hello! Welcome to Adobe Customer Service.
    Naveen Kumar: Hi
    you: Naveen, Can you help me by phone? the process has not worked.
    Naveen Kumar: Sure.
    Naveen Kumar: Please elaborate your issue, so that I will assist you better today.
    you: My phone number is 937-429-3474
    Naveen Kumar: I'm sorry to say that it's not possible to make a call to your number. If you have any issue please explain now on chat. Otherwise you have any work. Please contact us back when you have a free time.
    you: i got the serial number ok. But tried to sign in and the system said I needed to reset my pass word which I tried. Now nothing works and it keeps giving me the same suggestion of resetting passwork and that you will send me a message but none is coming.
    Naveen Kumar: May I know the serial number please?
    you: SN: [removed by moderator - never share S/N publicly - anyone can use it]
    Naveen Kumar: Thank you for information.
    Naveen Kumar: May I know when you have purchased this Photoshop Elements ?
    you: I purchased it yesterday at Best Buys our local store.
    Naveen Kumar: Thank you for confirming.
    Naveen Kumar: May I please have your email address registered with Adobe?
    you: [email protected]
    Naveen Kumar: Thank you for email address.
    Naveen Kumar: I see that this is a technical issue. I'll need to transfer this chat to the technical support team so that this issue is resolved in this first contact itself.
    you: So what do I do?
    Naveen Kumar: Please stay online while I transfer this chat to relevant team.
    Please wait while I transfer the chat to the appropriate group.
    You are now chatting with 'Manoj'
    Manoj: Hello. Welcome to Adobe Technical Support.
    Manoj: Hi There.
    Manoj: Please allow me a moment while I check your previous chat.
    You: That will be fine
    Manoj: Thank you for staying online.
    Manoj: I understand that you are unable to activate Photoshop Elements 13 application on your Windows 7 system. Is that right?
    You: Correct I have windows 7
    Manoj: Thank you for confirming the issue.
    Manoj: I will be glad to assist you in resolving this issue.
    Manoj: Just to be clear, could you please let me know where you are facing issues while trying to sign in?
    You: I tried to sign in from the reset password email you sent but it did not work when I reset the pass word
    Manoj: Okay.
    Manoj: May I know if you are able to install the Photoshop Elements 13 application?
    You: Another email has been received with same link to reset the pass word that went to Junk Mail. So what should I do?
    Manoj: I am sorry for the trouble caused.
    Manoj: Open Adobe.com on your system.
    You: I inserted the disk and input the serial number but can not get past the ID & pass word. It says the combination does not work
    Manoj: Okay.
    Manoj: Not to worry. Please open Adobe.com in web browser and try to sign in there.
    You: I have Adobe.com open and input my birth date. Now what do I do?
    Manoj: Thank you.
    Manoj: Now try to continue the installation.
    You: The page just give a bunch of marketing or sales items but no launch the program info.
    Manoj: Okay.
    Manoj: May I know if you are still unable to login with Adobe sign in details while the installation ?
    You: Now my CD Disc drive with the CD in it has refused to word. I have no way to sign in. I tried to get the set up through my control panel but it says install is trying to work and to retry but that will not work
    Manoj: Please check if there is an installation window which is already opened and try to continue with the installation process.
    Manoj: Check the task bar if there is the installation process is going on.
    You: Nothing is going on with installation. The disc drive light is not on. Basically it is locked up and I can not open it
    You: I tried the sign in button again but just got the same window to reset the pass word.
    Manoj: Okay.
    Manoj: Please close the installation window.
    Manoj: Run the set up file now and start the installation process.
    You: I closed all of the windows except this customer care window and my email
    Manoj: Thank you.
    Manoj: Now open the Disc drive.
    Manoj: Run the setup file and start the installation process.
    You: Okay the disc drive opened and is open now
    Manoj: Now please continue with the installation process.
    You: Do I just insert the Disc again?
    Manoj: Yes, please insert the disc.
    Manoj: Open the application folder.
    Manoj: Run the setup file and start the installation process.
    You: It brought up the install window and when i clicked on the install button it saad that installer was running and that I needed to close other adobe windows but only the customer care window is open
    You: It also has the disc drive locked up again
    Manoj: There might be an installer file running background.
    Manoj: Please press Ctrl+Shift+Esc keys together on your keyboard to open Task Manager.
    You: OK
    Manoj: Now go to Processes tab.
    Manoj: Click on Show processes from all users option and then check if there is any Setup.exe process is running.
    You: FireFox.exe *32 is large and running
    Manoj: No, please ignore it.
    Manoj: Check if there is a process named Set up.exe running in the processes tab and end the process if it is listed.
    You: There is no Set up.exe running listed on the page
    Manoj: Okay.
    Manoj: Try to start the installation now and check.
    Manoj: May I know the status please?
    You: I went to the Applications list and there was two Elements 13 there and one was running. I now have just one running but when I tried the installation again it just sent me to the sign in page which will not accept my old or new pass word
    You: I now have two programs running Adobe elements 13 and customer care via FireFox running
    Manoj: Okay.
    Manoj: Thank you for informing.
    You: The disc is not inserted at this time
    Manoj: Please insert the disc.
    Manoj: Copy the folder contents on your disc and then try installing the application.
    You: How do I do that?
    Manoj: Please insert the disc, open the disc folder, copy the entire Photoshop Elements 13 folder to the desktop.
    You: This says it will take 50 minutes to copy them. Is that correct as i have to go some place soon?
    Manoj: The files are huge in size, so it will take a while.
    You: It now says there are 14 minutes remaining
    Manoj: Thank you for informing.
    Manoj: If you want to try installing the application later, you can try installing the application from Desktop by running the setup file from the desktop app.
    You: There is still 8 minutes remaining. When this gets loaded to the desk top then what do I do.
    Manoj: Once the copy of files is completed. Remove the disc and then open the desktop Photoshop Elements 13 folder, run the setup file in that folder to start the installation.
    You: Ok. It still says it will take another 5 minutes to load
    Manoj: Thank you for informing.
    You: Now at 2.30 minutes remaining
    Manoj: Thank you for informing.
    You: Ok. The loading to desk top must be done & I have removed the disc
    Manoj: Thank you,.
    Manoj: Now open the folder which we copied now.
    Manoj: Run the Setup.exe file from the folder.
    You: i tried running the set up file but it says other items are open. I tried to close the one for sign i again and it will not close.
    Manoj: May I know the error it is showing as while trying to close the other installation window?
    You: The sign in window keeps asking for a ID & Password. When i put them in is says I must reset the pass word
    Manoj: Okay.
    Manoj: Close that previous installation window which is asking to reset the password and run the setup file now from the new folder which we copied now.
    You: I said it would send notice to my email but I checked both the email and the junk mail and nothing arrived
    Manoj: Robert, since the previous installation is started from the disc, we need to close that window and start installing from the desktop Photoshop Elements folder.
    You: Ok I got everything closed and will retry
    Manoj: Thank you.
    You: The installer initiation ran and now I am back to the same problem.. When I try to sign in it says I need a new pass word but nothing happens
    Manoj: Okay, Please allow me 2-3 minutes while I check and help you.
    Manoj: Thank you for staying online.
    Manoj: May I have your permission to connect to your computer remotely and try to solve the problem while you watch?
    You: yes but I am running out of time.
    Manoj: Okay.
    Manoj: Could you please let me know how much time is available for you so that we will check if it is okay for the troubleshooting?
    You: I have onlly 10 minutes left before I must leave. I can be back by 2030 (8:30 PM) if that will work
    Manoj: In this case, I will leave this open, please contact us back when you find free time so that we will continue from this point to resolve the issue as early possible.
    Manoj: Is that okay for you?
    You: How do I get back to you at customer care. I am not sure how I got to this point.
    You: Is there a reference number or ticket number I can use for reference
    Manoj: Please use the bellow link to contact us back.
    Manoj: http://helpx.adobe.com/contact/
    Manoj:
    Manoj:
    You: OK
    Manoj: I will make a note of the troubleshooting steps what we performed earlier, when you contact us back. Our agents will go through this interaction and continue from this point only.

    To attempt a new chat session...
    For the link below click the Still Need Help? option in the blue area at the bottom and choose the chat option...
    http://helpx.adobe.com/x-productkb/global/service1.html

  • My little brother messed up with my iPod touch 4th Gen by entering the wrong password , now all data is beeing erased what should I do.The iPod is just showing the Apple Logo and some buffering icon below it.Need help fast!I'm really worried!

    I really need help this has happend 5 hours ago and the ipod os still showing the apple logo and the buffering icon below it!
    It re booted several times till now.
    Need help fast!

    - I suspect that he went to Settings>General>Reset>Erase all content and settings.  For 1G or 2G iPod that can take hours and it will likely stall out if not connected to a charging source.
    Try the following:
    - A reset.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - The connect to computer and try to restore via iTunes.
    - Id something is still showing onthe screen, disconnect from computer/charging source and let the battery fully drain. After charging for an hour, Try the reset and restore.
    - If you can turn the iPod off, se if placing the iPod in recovery mode and then restore. For recovey mode:
    iPhone and iPod touch: Unable to update or restore

  • Need help on the below query.

    Hi All,
    I've a query given below..
    SELECT W.WONUM,
         W.STATUS,
         WS.CHANGEDATE,
         EH.OLD_RATE
         FROM
         WORKORDER W,
         WOSTATUS WS,
         ESTIMATE_HEADER@GQMFOF EH
    WHERE WS.CHANGEDATE BETWEEN '01-Oct-2009' AND '1-Nov-2009'
    AND W.WONUM = WS.WONUM
    AND EH.OLD_RATE = 'N'
    AND WS.WOSTATUS = 'CLOSE';
    I would like to get All the data which status =closed in the month of Oct for Old rate,
    So for this i am writing the query above. But not getting the o/p.
    It is giving me that " Table/View doesn't exist.
    There 2 schemas MAXIMO,GQMMGR..
    DBlinks are GQMFOF,MAXFOFNC..
    Can anyone help me while writing the above query...
    Regards,
    gr.

    A question was asked in your other thread. But the problem was you dint care to give an answer.
    Dont open duplicate post.
    I need help on the below problem..

  • Need Help on below Query.

    Hi All,
    Need Help on below Query.
    Consider,
    "test9" Table Data in COLUMN "Name" AS
    Name
    =====
    'a'
    'b'
    'c'
    'd'
    'e'
    I am writing a query as :
    SELECT * FROM test9 WHERE Name IN ('a','b','c','d','e','f','g')
    I want result set as , It should show data as -
    'f'
    'g'
    i.e. data which does not exists in the table and which is give in in clause
    Is it possible in a single query.

    You can put the data that is to be checked for into a table instead or an inline view, for example:
    with t as
    (select 'a' as c1 from dual
    union all
    select 'b' from dual
    union all
    select 'c' from dual
    union all
    select 'd' from dual
    union all
    select 'e' from dual)
    select c1 from (select 'a' as c1 from dual
    union all
    select 'b' from dual
    union all
    select 'c' from dual
    union all
    select 'd' from dual
    union all
    select 'e' from dual
    union all
    select 'f' from dual
    union all
    select 'g' from dual)
    minus
    select c1 from t
    C
    f
    g
    2 rows selected.

  • I need help on the below problem..

    Hi All,
    I need help on the below problem..
    I've 2 Schemas called
         1. MAXIMO and DBLink is GQMFOF
         2. GQMMGR adn DBLink is MAXFOFNC
    Now i would likw to retrive the data from both the schemas,
    i.e some columns from WORKORDER table of maximo schema and some columns from ESTIMATE_HEADER table
    of GQMMGR schema..
    I'm trying to get the data using DB links, but it is giving TABLE/VIEW doesn't exist.
    Please help me on this.
    Regards,
    gr.

    Does your user has the SELECT privelage granted for accessing those tables?

  • Need Helping hand on below result

    Hi All,
    Need a  helping hand to get below result in Sql server query.
    Source table data:
    SW
    SM
    SaName
    Commitment
    ID
    QP
    Week 2 October, 2014
    October, 2014
    Solution
    Uncommitted Upside
    6-53I6YHDDI
    311219.6888
    Week 3 October, 2014
    October, 2014
    Solution
    Uncommitted Upside
    6-53I6YHDDI
    483853.9999
    Week 4 October, 2014
    October, 2014
    Solution
    Uncommitted Upside
    6-53I6YHDDI
    483853.9999
    Week 5 October, 2014
    October, 2014
    Solution
    Uncommitted Upside
    6-53I6YHDDI
    483853.9999
    Week 1 November, 2014
    November, 2014
    Proof
    Uncommitted Upside
    6-53I6YHDDI
    483853.9999
    Expecting Result in a single record for ID
    Result
    Week 2 October, 2014 QP
    Week2 CommitmentLevel
    Week 2 October, 2014 SalesStageName
    Week 3 October, 2014 QP
    Week3 CommitmentLevel
    Week 3 October, 2014 SalesStageName
    Week 4 October, 2014 QP
    Week4 CommitmentLevel
    Week 4 October, 2014 SalesStageName
    6-53I6YHDDI
    311219.6888
    Uncommitted Upside
    Solution
    483853.9999
    Uncommitted Upside
    Solution
    483853.9999
    Uncommitted Upside
    Solution
    Thanks in Advance...

    vgvchinna,
    See below two ways to get data in your desired format.
    The 1st is a simple OUTER JOIN after partitioning the data using CTE.
    The 2nd introduces the SW date column three times with aliases to use with three PIVOTs for each column of data. It then wraps the results in a MAX+GROUP BY to flatten it out.
    I can think of a 3rd approach using CASE statements too but not including the SQL code for that here.
    As you can see both these approaches are complex and not easily scalable. There is also dependency on you knowing the values beforehand to put in the WHERE clause (1st approach) or the PIVOT (in 2nd approach). Removing this dependency will
    require dynamic SQL which will complicate the solution even more.
    Let us know in this forum if you'd like any explanation on these two approaches.
    On a side note, I'd also suggest that when you ask a question in any forum, include as much info as possible e.g. the CREATE/INSERT scripts, properly formatted desired output, what approaches have you already tried, your comfort
    and skill level with the technology etc. so that you get better answers and also save time for the people who respond to you.
    Good luck!
    declare @t table
    ID varchar(20)
    , SW varchar(25)
    , QP varchar(20)
    , CommitmentLevel varchar(20)
    , SaleStageName varchar(20)
    insert into @t
    values
    ('6-53I6YHDDI', 'Week 2 October, 2014', '311219.6888', 'Uncommitted Upside', 'Solution'),
    ('6-53I6YHDDI', 'Week 3 October, 2014', '483853.9999', 'Uncommitted Upside', 'Solution'),
    ('6-53I6YHDDI', 'Week 4 October, 2014', '483853.9999', 'Uncommitted Upside', 'Solution'),
    ('6-53I6YHDDI', 'Week 1 November, 2014', '483853.9999', 'Uncommitted Upside', 'Proof')
    select * from @t--------------------
    -- Method 1 with CTE
    ;with
    wk2 as (select ID, QP as wk2QP, CommitmentLevel as wk2CommitmentLevel, SaleStageName as wk2SaleStageName from @t where SW = 'Week 2 October, 2014'),
    wk3 as (select ID, QP as wk3QP, CommitmentLevel as wk3CommitmentLevel, SaleStageName as wk3SaleStageName from @t where SW = 'Week 3 October, 2014'),
    wk4 as (select ID, QP as wk4QP, CommitmentLevel as wk4CommitmentLevel, SaleStageName as wk4SaleStageName from @t where SW = 'Week 3 October, 2014'),
    wk1Nov as (select ID, QP as wk1NovQP, CommitmentLevel as wk1NovCommitmentLevel, SaleStageName as wk1NovSaleStageName from @t where SW = 'Week 1 November, 2014')
    select
    coalesce(wk2.ID, wk3.ID, wk4.ID, wk1Nov.ID) as Result,
    wk2QP, wk2CommitmentLevel, wk2SaleStageName,
    wk3QP, wk3CommitmentLevel, wk3SaleStageName,
    wk4QP, wk4CommitmentLevel, wk4SaleStageName,
    wk1NovQP, wk1NovCommitmentLevel, wk1NovSaleStageName
    from wk2 full outer join wk3
    on wk2.ID = wk3.ID
    full outer join wk4
    on wk2.ID = wk4.ID
    full outer join wk1Nov
    on wk2.ID = wk1Nov.ID
    -- Method 2 with PIVOT
    select ID
    , max([Week 2 October, 2014QP]) as wk2QP, max([Week 2 October, 2014CommitmentLevel]) as wk2CommitmentLevel, max([Week 2 October, 2014SaleStageName]) as wk2SaleStageName
    , max([Week 3 October, 2014QP]) as wk3QP, max([Week 3 October, 2014CommitmentLevel]) as wk3CommitmentLevel, max([Week 3 October, 2014CommitmentLevel]) as wk3SaleStageName
    , max([Week 4 October, 2014QP]) as wk4QP, max([Week 4 October, 2014CommitmentLevel]) as wk4CommitmentLevel, max([Week 4 October, 2014QP]) as wk3SaleStageName
    , max([Week 1 November, 2014QP]) as wk1NovQP, max([Week 1 November, 2014CommitmentLevel]) as wk1NovCommitmentLevel, max([Week 1 November, 2014QP]) as wk1NovSaleStageName
    from
    ( select ID, SW+'QP' as SWQP, QP, SW+'CommitmentLevel' as SWCommitmentLevel, CommitmentLevel, SW+'SaleStageName' as SWSaleStageName, SaleStageName from @t ) as pivotquery
    PIVOT ( MAX(QP) for SWQP in ([Week 2 October, 2014QP], [Week 3 October, 2014QP], [Week 4 October, 2014QP], [Week 1 November, 2014QP]) ) as pvtQP
    PIVOT ( MAX(CommitmentLevel) for SWCommitmentLevel in ([Week 2 October, 2014CommitmentLevel], [Week 3 October, 2014CommitmentLevel], [Week 4 October, 2014CommitmentLevel], [Week 1 November, 2014CommitmentLevel]) ) as pvtCommitmentLevel
    PIVOT ( MAX(SaleStageName) for SWSaleStageName in ([Week 2 October, 2014SaleStageName], [Week 3 October, 2014SaleStageName], [Week 4 October, 2014SaleStageName], [Week 1 November, 2014SaleStageName]) ) as pvtSaleStage
    group by ID
    - Aalamjeet Rangi | (Blog)

  • Weird error message need help..

    SO.. i havent updated my itunes in a while because i keep getting this weird message.. it comes up when im almost done installing the newest/newer versions of itunes. it says
    "the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"
    now when ever i choose a file from the browse box it replies with this message "the file 'xxx' is not a valid installation package for the product iTunes. try to find the installation package iTunes.msi in a folder from which you can install iTunes."
    no idea need help thanks
    ~~~lake
    Message was edited by: DarkxFlamexCaster
    Message was edited by: DarkxFlamexCaster

    +it comes up when im almost done installing the newest/newer versions of itunes. it says+ +"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"+
    With that one, let's try the following procedure.
    First, head into your Add/Remove programs and uninstall your QuickTime. If it goes, good. If it doesn't, we'll just attend to it when we attend to iTunes.
    Next, download and install the Windows Installer CleanUp utility:
    Description of the Windows Installer CleanUp Utility
    Now launch Windows Installer CleanUp ("Start > All Programs > Windows Install Clean Up"), find any iTunes and/or QuickTime entries in the list of programs in CleanUp, select those entries, and click “remove”.
    Next, we'll manually remove any leftover iTunes or QuickTime program files:
    (1) Open Local Disk (C:) in Computer or whichever disk programs are installed on.
    (2) Open the Program Files folder.
    (3) Right-click the iTunes folder and select Delete and choose Yes when asked to confirm the deletion.
    (4) Right-click the QuickTime folder and select Delete and choose Yes when asked to confirm the deletion. (Note: This folder may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (5) Delete the QuickTime and QuicktimeVR files located in the C:\Windows\system32\ folder. Click Continue if Windows needs confirmation or permission to continue. (Note: These files may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (6) Right-click on the Recycle Bin and on the shortcut menu, click Empty Recycle Bin.
    (7) Restart your computer.
    Now try another iTunes install. Does it go through properly now?

  • Need help adobe bridge cc output module

    I need help. I have an assignment I'm held up on completing because the adobe cc bridge does not have the output modue I need. I followed the adobe instructions page to the letter. I copied and pasted the output module folder to the adobe bridge cc extensions folder in programs/commonfiles/adobe. The only thing is the instructions then say to paste the workspace file into the workspace folder located below the bridge extensions folder. I don't have a workspaces folder there or anywhere. I even tried must making one and adding the file to it, but no go. can someone PLEASE help me with this?    I have an assignment due like now that requires the use of the output modue.thanks!

    oh,my system is windows 8.1. sorry, lol.

  • Stored DB Procedure - Need help

    Hi. I have a stored database package containing 2 functions. I need help with the function named ret_columns.
    If you look at the code below you will see this function has two different FOR loops. The Select statement in FOR loop that is commented out works just fine, but when I try to use the uncommented select statement in it's place the Function returns NULL (or no records). However, if I run the Select statement in plain old SQL Plus it returns the rows I need. I don't get it.
    Can anyone help me? I'm really stuck on this one.
    -- PACKAGE BODY
    CREATE OR REPLACE package body audit_table_info
    as
    function ret_tables return table_type is
    t_t table_type;
    i integer;
    begin
    i := 1;
    for rec in (select distinct table_name
    from all_triggers
                   where substr(trigger_name,1,9) = upper('tr_audit#')) loop
    t_t(i).tableA := rec.table_name;
    i := i+1;
    end loop;
    return t_t;
    end;
    function ret_columns return column_type is
    c_t column_type;
    i integer;
    begin
    i := 1;
    -- for rec in (select distinct table_name column_name
    -- from all_triggers
    --               where substr(trigger_name,1,9) = upper('tr_audit#')) loop
    for rec in (select distinct b.column_name column_name
    from all_triggers a, all_tab_columns b
                   where a.table_owner = b.owner
                        and a.table_name = b.table_name
                             and substr(a.trigger_name,1,9) = upper('tr_audit#') and rownum < 5) loop                    
    c_t(i).tableB := rec.column_name;
    i := i+1;
    end loop;
    return c_t;
    end;
    end audit_table_info;
    -- PACKAGE DEFINITION
    CREATE OR REPLACE package Audit_Table_Info as
    type table_rec is record( tableA all_tab_columns.TABLE_NAME%type);
    type table_type is table of table_rec index by binary_integer;
    function ret_tables return table_type;
    type column_rec is record( tableB all_tables.TABLE_NAME%type);
    type column_type is table of column_rec index by binary_integer;
    function ret_columns return column_type;
    end Audit_Table_Info;
    /

    It works when I do this!!! I'm so confused.
    Ok...so I did this:
    1 create table test_columns as
    2 (select b.column_name
    3 from all_triggers a,
    4 all_tab_columns b
    5 where a.table_owner = b.owner
    6 and a.table_name = b.table_name
    7 and substr(a.trigger_name,1,9) = upper('tr_audit#')
    8* and rownum < 5)
    SQL> /
    Table created.
    Then altered the Function so the Select statement refers to this table:
    function ret_columns return column_type is
    c_t column_type;
    i integer;
    begin
    i := 1;
    for rec in (select distinct column_name
    from test_columns) loop
    c_t(i).tableB := rec.column_name;
    i := i+1;
    end loop;
    return c_t;
    end;
    Again, any help would be greatly greatly appreciated!

Maybe you are looking for