Pre-Query - Modifying the default_where

Hi,
I'm trying to get the value of the default_where clause to modify it (with set_block_property) after the user has entered the ENTER QUERY MODE and decides to RUN QUERY. I'm creating a Pre-Query event for the module component where the search criteria are entered, but it doesn't seem to work; the where_clause (l_old_where) I retrieve is always empty. My code to retrieve the default_where is:
BEGIN
DECLARE
l_block VARCHAR2(32) := name_in('system.trigger_block');
l_old_where VARCHAR2(2000);
BEGIN
l_old_where := get_block_property(l_block, default_where);
message('l_old_where =' || l_old_where); --unfortunately this message always returns an empty value
EXCEPTION
WHEN VALUE_ERROR THEN
qms$forms_errors.push(QMS$FORMS_ERRORS.MSGGETTEXT(33, 'Query criteria too complex - simplify and re-query'), 'E', 'OFG', 33);
qms$forms_errors.raise_failure;
END;
END;
Does anybody know what I am doing wrong? Do you have a better way to retrieve the default_where value?
Thanks,
Denis.

Denis,
The DEFAULT_WHERE is part of all queries. It is set either in the property palette at design time, or programatically at runtime. If a user does an enter query and specifies some criteria, that criteria is appended to the DEFAULT_WHERE. Thus, interrogating the DEFAULT_WHERE won't help you in this case.
There is no "nice" way to do this. You have about three triggers you can choose from, that get fired after the users has entered their criteria, but before the query is executed. One is PRE-QUERY, and I forget the other two. One of them is SET-QUERY or something like that.
What you do is interrogate the fields themselves. For example, if you have two fields: NAME and SALARY, and the user entered the criteria "A%" and ">5000", then it's up to you to examine those fields to see what the user typed. Then you can do with them what you will.
So you don't get the SQL that Forms generates, but you do get the same info that Forms uses to generate the SQL.
There is also a gotcha to look out for. When referring to fields in a block that are active during enter-query mode, use the NAME_IN builtin. For example, the SALARY field is of type number, but the criteria is ">5000". That ">" is not acceptable (normally) to a NUMBER field, so you will get errors if you do something like "message('Salary criteria: '||:block.salary);"
I hope this helps.
Regards,
Robin Zimmermann
Forms Product Management

Similar Messages

  • Pre-query trigger issue

    Hi,
    I have a datablock in the form that is based on a DB table. There are few queriable fields in the block including begin and end dates. If i dont use any pre-query trigger, the records are queried fine. But I want to do a range selection between begin and end_Date fields. Therefore I created a pre-query trigger and set a new_where_clause with all my query_fields and set that as defualt where for my DB block.
    SET_BLOCK_PROPERTY (block_id,default_where, where_clause);
    But when I see the query in toad session , the query looks like
    WHERE (field_1 = :1) and field_1 = :1
    that means its running the defualt where clause on the block and the new_where clause at the same time.
    I checked the form and I dont have any calls to execute query....
    what can be the problem?

    1. What is your new_where_clause? (example, please)It's hard to read. Use the \{code\} tag.
    FUNCTION get_comparison_phrase (database_column_name       VARCHAR2,
                                                             relational_operator       VARCHAR2,
                                                             selection_field_name       VARCHAR2)
              RETURN VARCHAR2 IS
         BEGIN
              RETURN CASE
                              WHEN NAME_IN (selection_field_name) IS NOT NULL THEN
                                        ' AND '
                                   || database_column_name
                                   || relational_operator
                                   || ' :'
                                   || selection_field_name
                              ELSE
                                   NULL
                         END;
         END get_comparison_phrase;
    where_clause := 'WHERE (1=1)';
    if NAME_IN (selection_field_name) IS NOT NULL THEN       ' AND '
                                   || database_column_name
                                   || relational_operator
                                   || ' :'
                                   || selection_field_name
                              ELSE
                                   NULL
                         END;
    where_clause :=
         where_clause
              || get_comparison_phrase (
                        'screening_group_num',
                        '=',
                        'EXCEPTIONAL_EVENTS.screening_group_num'
    WHERE (field_1 = :1) and field_1 = :1I do not see 'WHERE (1=1)'; there.
    Edited by: Michael Roy on Oct 21, 2009 9:47 AM

  • How to invoke Standard BOM form in pre-queried mode?

    Hi,
    I need to invoke the Standard Oracle BOM form from a custom form developed.
    I have the Bill Sequence ID, Inventory Item ID and the Organization ID available in the custom form.
    Currently this is how I am trying:
    fnd_function.EXECUTE
         (function_name => 'BOM_BOMFDBOM',
         open_flag => 'Y',
         session_flag => 'N',
         other_params => 'BILL_SEQ_ID="'
         || l_num_bill_seq_id
         || '" INV_ITEM_ID="'
         || l_num_inv_item_id
         || '" ITEM_ID="'
         || l_num_inv_item_id
         || '" ORG_ID="'
         || :parameter.org_id
    || '" G_QUERY_FIND= "'
    || 'TRUE'
         || '"'
    The form does open up. But not pre-queried for the Bill Sequence I pass to it.
    Can anyone please let me know if I am missing something.
    Thanks a bunch,
    Vinay.

    This might help
        If :b_bill_of_matls.Assembly_Item_Id is not null then
          X_Parameters :=
            ' ASSEMBLY_ITEM_ID='||to_char(:b_bill_of_matls.Assembly_Item_id);
          If :b_bill_of_matls.Alternate_bom_Designator is not null then
            X_Parameters := X_Parameters ||
            ' ALTERNATE='||:b_bill_of_matls.Alternate_bom_Designator;
          End if; -- alternate
          X_Parameters := X_Parameters ||
            ' ORG_ID='||to_char(:Parameter.Org_Id)||
            ' ORG_CODE='||:Parameter.Org_Code;
        End if; -- specific routing
        Fnd_Function.Execute(
          function_name => X_Function,
          open_flag => 'Y',
          session_flag => 'Y',
          other_params  => X_Parameters);

  • VO Extension Error in modifying the query of XML Publisher Report Template

    Hi Friends,
    I have one requirement related to calling XML Publisher Reports Template from OAF Page.
    When clicking on the submit button the XML Publisher template is calling and displaying the data.
    Our requirement is to display some more columns in the XML Publisher Template and display the data.
    As according to OAF stndards,whenever we need to add new columns for display or SELECT purpose,
    we will do the VO Extension. So we modified the query by adding the new additional colums in the standard VO.
    I am able to retrieve the data from the SQL DEVELOPER. But when doing the VO Extension process and
    calling the template from the OAF page its throwing the following error.Please suggest me some alternatives
    to fix the issue.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT
    DECODE(ASO_QUOTES.RESOURCE_ID, null, sales.name, sales1.name) sales_rep_name,
    aso_quotes.quote_name,
    aso_quotes.contract_id,
    aso_quotes.quote_number||decode(aso_quotes.quote_version,NULL,'',' - ') || aso_quotes.quote_version quote_name_version,
    to_char(aso_quotes.quote_expiration_date, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) quote_expiration_date,
    TO_NUMBER(TO_CHAR(aso_quotes.quote_expiration_date,'J')) - TO_NUMBER(TO_CHAR(Sysdate,'J')) duration,
    I_HEADER_CONTACT_PARTY.PARTY_NAME sold_to_contact_name,
    I_CUST_PARTIES.party_name customer_name,
    I_PHONE.PHONE_AREA_CODE || DECODE(I_PHONE.PHONE_AREA_CODE , NULL, '',' ' ) || I_PHONE.PHONE_NUMBER full_phone_number,
    I_INVOICE_REL_PARTY.PARTY_NAME invoice_to_contact_name,
    I_ACCTS_INV_PARTY.PARTY_NAME invoice_to_cust_party_name,
    I_INVOICE_LOCATIONS.ADDRESS1 invoice_to_address1,
    I_INVOICE_LOCATIONS.ADDRESS2 invoice_to_address2,
    I_INVOICE_LOCATIONS.ADDRESS3 invoice_to_address3,
    I_INVOICE_LOCATIONS.ADDRESS4 invoice_to_address4,
    decode(I_INVOICE_LOCATIONS.city, null,'',I_INVOICE_LOCATIONS.city || decode(I_INVOICE_LOCATIONS.county,null,'',',' || I_INVOICE_LOCATIONS.county)) invoice_to_city,
    I_INVOICE_LOCATIONS.state || decode(I_INVOICE_LOCATIONS.postal_code, null,'',' '||
    I_INVOICE_LOCATIONS.postal_code || decode(I_INVOICE_LOCATIONS.province,null,'',',' ||I_INVOICE_LOCATIONS.province )) invoice_to_county,
    I_INVOICE_LOCATIONS.country invoice_to_country,
    aso_quotes.currency_code Currency_Code,
    (select distinct ppf.email_address
    from per_people_f ppf,
    JTF_RS_SALESREPS jrs
    where jrs.resource_id = aso_quotes.resource_id
    and jrs.PERSON_ID = ppf.person_id
    and ppf.person_type_id = 3
    ) Sales_Rep_Email,
    aso_quotes.quote_header_id, oav.name||decode(oav.agreement_num,NULL,'',',')||oav.agreement_num||decode(oav.agreement_num,NULL,'',',')||oav.revision Agreement_name,
    oav.name||oav.agreement_num||oav.revision Agreement_check,
    to_char(oav.revision_date, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) revision_date,
    (select payment_term_name
    FROM
    aso_payments_v
    WHERE
    quote_line_id is null and
    quote_header_id = aso_quotes.quote_header_id) payment_terms,
    to_char(sysdate, nvl(FND_PROFILE.VALUE('ICX_DATE_FORMAT_MASK'), 'DD-MON-RRRR')) curr_date,
    aso_quotes.total_list_price total_list_price,
    aso_quotes.total_adjusted_amount total_adjusted_amount,
    (aso_quotes.total_list_price + aso_quotes.total_adjusted_amount) total_net_price,
    aso_quotes.total_shipping_charge charges_total,
    aso_quotes.total_tax taxes_total,
    aso_quotes.total_quote_price total_quote_price,
    (select cust_po_number
    FROM
    aso_payments
    WHERE
    quote_line_id is null and
    quote_header_id = aso_quotes.quote_header_id ) cust_po_number,
    (select fct.name
    from fnd_currencies_tl fct
    where aso_quotes.currency_code = fct.currency_code
    and fct.language = userenv('lang')) Currency_Name,
    (select fcurr.symbol
    from fnd_currencies fcurr
    where aso_quotes.currency_code = fcurr.currency_code) Currency_Symbol,
    (Select meaning
    From oe_lookups
    Where lookup_type = 'FREIGHT_TERMS'
    And lookup_code = (select aship.freight_terms_code
    from aso_shipments aship
    where aship.quote_header_id = aso_quotes.quote_header_id
    and aship.quote_line_id is null)) Freight_Terms,
    (Select fl.meaning
    From fnd_lookup_values fl
    where fl.lookup_type = 'SHIP_METHOD'
    And fl.lookup_code = (select aship.ship_method_code
    from aso_shipments aship
    where aship.quote_header_id = aso_quotes.quote_header_id
    and aship.quote_line_id is null)
    And fl.language = userenv('LANG')) shipping_method ,
    aso_quotes.org_id ,
    aso_quotes.quote_number ,
    aso_quotes.Quote_version VersionNumber,
    I_ACCTS.ACCOUNT_NUMBER CustomerNumber,
    oav.agreement_num Agreement_Number,
    :action action,
    aso_quotes.minisite_id minisite_id,
    (select imt.msite_name from ibe_msites_tl imt where imt.msite_id = aso_quotes.minisite_id
    and imt.language = userenv('LANG')) msite_name,
    (select asl.meaning from oe_lookups asl, aso_shipments ash
    where asl.lookup_type = 'SHIPMENT_PRIORITY'
    and asl.lookup_code = ash.shipment_priority_code
    and ash.quote_header_id = aso_quotes.quote_header_id) shipment_priority_name
    ,(select OE_SYS_PARAMETERS.VALUE('INSTALLMENT_OPTIONS',aso_quotes.org_id) from dual) enable_pay_now
    from
    hz_CONTACT_POINTS I_PHONE ,
    HZ_RELATIONSHIPS I_HEADER_CONTACT_REL,
    HZ_PARTIES I_HEADER_CONTACT_PARTY,
    ASO_QUOTE_HEADERS ASO_QUOTES,
    HZ_RELATIONSHIPS I_INVOICE_REL,
    HZ_PARTIES I_INVOICE_REL_PARTY,
    HZ_PARTY_sites I_INVOICE_PARTY_SITES,
    HZ_LOCATIONS I_INVOICE_LOCATIONS,
    HZ_PARTIES I_CUST_PARTIES,
    HZ_CUST_ACCOUNTS I_ACCTS,
    HZ_CUST_ACCOUNTS I_ACCTS_INV,
    HZ_PARTIES I_ACCTS_INV_PARTY,
    JTF_RS_SALESREPS_MO_V SALES,
    JTF_RS_SALESREPS_MO_V SALES1,
    FND_TERRITORIES_VL I_TERRITORIES,
    oe_agreements_vl oav
    where
    ASO_QUOTES.PARTY_ID = I_HEADER_CONTACT_REL.PARTY_ID(+)
    AND I_HEADER_CONTACT_REL.SUBJECT_ID = I_HEADER_CONTACT_PARTY.PARTY_ID(+)
    AND I_HEADER_CONTACT_REL.SUBJECT_TYPE(+) = 'PERSON'
    AND I_HEADER_CONTACT_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
    and i_header_contact_rel.object_id(+) = aso_quotes.cust_party_id
    AND ASO_QUOTES .INVOICE_TO_PARTY_SITE_ID = I_INVOICE_PARTY_SITES.PARTY_SITE_ID (+)
    AND I_INVOICE_PARTY_SITES.LOCATION_ID = I_INVOICE_LOCATIONS.LOCATION_ID(+)
    AND I_INVOICE_LOCATIONS.country = I_TERRITORIES.territory_code(+)
    AND ASO_QUOTES.INVOICE_TO_PARTY_ID = I_INVOICE_REL.PARTY_ID(+)
    AND I_INVOICE_REL.SUBJECT_ID = I_INVOICE_REL_PARTY.PARTY_ID(+)
    AND I_INVOICE_REL.SUBJECT_TYPE(+) = 'PERSON'
    AND I_INVOICE_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
    AND i_invoice_rel.object_id (+) = aso_quotes.invoice_to_cust_party_id
    AND ASO_QUOTES.ORG_ID = SALES.ORG_ID(+)
    AND ASO_QUOTES.EMPLOYEE_PERSON_ID = SALES.PERSON_ID (+)
    AND ASO_QUOTES.ORG_ID = SALES1.ORG_ID (+)
    AND ASO_QUOTES.RESOURCE_ID = SALES1.RESOURCE_ID (+)
    AND ASO_QUOTES.CUST_ACCOUNT_ID =I_ACCTS.CUST_ACCOUNT_ID(+)
    AND ASO_QUOTES.CUST_PARTY_ID = I_CUST_PARTIES.PARTY_ID
    AND ASO_QUOTES.INVOICE_TO_CUST_ACCOUNT_ID = I_ACCTS_INV.CUST_ACCOUNT_ID(+)
    AND ASO_QUOTES.INVOICE_TO_CUST_PARTY_ID = I_ACCTS_INV_PARTY.PARTY_ID(+)
    AND aso_quotes.phone_id = i_phone.contact_point_Id(+)
    AND oav.agreement_id(+) = aso_quotes.contract_id
    AND aso_quotes.quote_header_id = 666584
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:886)
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:1009)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:211)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
         at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)
    ## Detail 0 ##
    java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: 1
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11915)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3919)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13827)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3723)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3643)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.apps.aso.print.server.PrintQuoteAMImpl.queryQuote(PrintQuoteAMImpl.java:447)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
         at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)
    java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: 1
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11915)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3919)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13827)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:804)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:669)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3723)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:743)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:892)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:806)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:800)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3643)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.apps.aso.print.server.PrintQuoteAMImpl.queryQuote(PrintQuoteAMImpl.java:447)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:762)
         at oracle.apps.aso.print.webui.MainCO.processRequest(MainCO.java:180)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:600)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAHeaderBean.processRequest(OAHeaderBean.java:391)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:619)

    "java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL"
    Try the suggestions in this? https://kr.forums.oracle.com/forums/thread.jspa?messageID=10253362
    Check the bindign styles and bind variables..

  • How do I modify the WHERE clause in my SQL query?

    This seems like such a straight-forward part of the report design, but I'm fairly new to Crystal Reports and I only have experience with modifying reports someone else has already written.  In this particular case, I just need to modify the WHERE clause of the SQL query.  I can select Show SQL Query and see what statement is being used to select data, but I can't find where to modify it since it's grayed out.  I see how to change the selection criteria, parameters, grouping, etc...just not the WHERE clause.  The report is linked to a database used for reporting with a table created and populated by a stored procedure.  I don't need to modify the stored procedure because the data I want to filter by is currently in the table--I just don't know how to filter by what I need.  Here's part of the query:
    SELECT "rpt_dist"."startdate", "rpt_dist"."transtype", "rpt_dist"."laborcode", "rpt_dist"."crewid", "rpt_dist"."regularhrs" FROM   "Reporting"."dbo"."rpt_dist" "rpt_dist"
    WHERE  (rpt_dist."transtype" <> 'WORK' AND rpt_dist."transtype" <> 'WMATL') AND rpt_dist."laborcode" LIKE 'S%' AND (rpt_dist."crewid" = 'HOUS' OR rpt_dist."crewid" = 'HOUS2' ...
    I would like to add another crewid to the WHERE clause.  Thanks for any input.

    1.Open the report in the crystal designer
    2.Go to the field explorer(if hidden go to view menu->field explorer)
    3.Rt. click on the database fields->choose database expert
    4.Now you will see 2 columns-Available DataSource  and Selected Tables
    5.Rt. click on the object(ex.command) available in the Selected Tables column->Choose Edit command
    6.A new Modify Command window will appear,here you can edit your SQL Query
    I get to step 4 and I see the two columns including my database and the report table, but there is no command object available.  If I right-click on my table, I can just view the Properties. ??
    As for the other tip to modify the record selection:  I don't see anywhere the other crewid values are set and if I add the one I'm missing, it doesn't modify the existing SQL Query and when I preview the report it throws off the results so that no data displays??
    I'm using Crystal Reports 11.5 if that makes a difference.  Thanks again.

  • Modify the Field Type of standard Table fields in a Query

    Hello. I have a question.
    Is there a way to "modify" the field type for standard table fields that are included in a Query?
    I made a simple query out of a join of tables, but several fields have a lot of decimals, and I would like to present them in the query without any decimals, just as a regular "N" field.
    I tried the possibility of creating extra local fields where all I do is transfer the value to the new "N" field, but I have many fields like this, so if there's a better way; I'd prefer that.
    Maybe somewhere in the InfoSet there's a way to modify the type of the standard table fields?
    Thank you.

    Hi,
    This document may help you out.
    [http://help.sap.com/saphelp_erp60_sp/helpdata/en/d2/cb4468455611d189710000e8322d00/frameset.htm|http://help.sap.com/saphelp_erp60_sp/helpdata/en/d2/cb4468455611d189710000e8322d00/frameset.htm]
    Cheers,

  • In query designer , cant able to change/modify the query porperties

    hai experts / friends
    even in production or develeopment i have selected one query in query designer and opened and after that am selecting one default value and then right hand side it displays the properties of that particular query then i can not modify the changes ...that Display and change option is in disable....how can i enable this button...
    please help me friends...
    previously i have tried using production and then i thought because of production it is not getting enabled then i tried in development , and came to know that even in development also same problem it is not getting enabled....
    thanks in advance..
    regards
    anand

    hai friends..
    thanks for all your reply...
    actually i want to explain detail  ..
    after selecting the one particular query , am just placing the mouse in my charecteristics restrictions and then right hand side
    properties window gets displayed and at the top we can find display/change button and save button technical name
    button
    in that display and change button is disabled...i want that button to be enabled.
    i have checked in my authorizations in SU01...
    even i have all the profiles like SAP_ALL ...
    and then i have been trying to have transaport connection and then creating transport conn. for BeX...but it is asking package name...
    in this case i dont know the exact package name....
    can any body help me in this regard???
    thanks
    anand

  • Hellp needed urgent in modifying the query

    my requriment is as follows.
    the data looks like as follows - 3 columns
    sheet_id sequence_no rap_no
    1 2
    1 4
    1 5
    1 1
    2 4
    2 6
    2 7
    3 8
    3 10
    4 3
    4 7
    and the max of seqno should be updated on rap_no.
    is the group by clause not neededin the following query .
    In tht case how to modify the foll query.
         update t3756_cue_sheet_music a set a.c3756_rap_sequence_no=
    (select max(to_number(c3756_sequence_no))
    FROM t3756_cue_sheet_music b
    where a.c3756_cue_sheet_id = b.c3756_cue_sheet_id)
    WHERE c3756_rap_sequence_no is NULL;
    Thanks in advance.
    Do reply

    Can you be a little more clear?
    create table t
    (sheet_id number
    ,sequence_no number
    ,rap_no number);
    alter table t add constraint tpk primary key (sheet_id, sequence_no);
    insert into t (sheet_id, sequence_no) values (1, 2);
    insert into t (sheet_id, sequence_no) values (1, 4);
    insert into t (sheet_id, sequence_no) values (1, 5);
    insert into t (sheet_id, sequence_no) values (1, 1);
    insert into t (sheet_id, sequence_no) values (2, 4);
    insert into t (sheet_id, sequence_no) values (2, 6);
    insert into t (sheet_id, sequence_no) values (2, 7);
    insert into t (sheet_id, sequence_no) values (3, 8);
    insert into t (sheet_id, sequence_no) values (3, 10);
    insert into t (sheet_id, sequence_no) values (4, 3);
    insert into t (sheet_id, sequence_no) values (4, 7);
    update t a
    set a.rap_no=
    (select max(to_number(sequence_no))
    FROM t b
    where a.sheet_id = b.sheet_id)
    WHERE rap_no is NULL;
    select *
      from t;
    SHEET_ID SEQUENCE_NO         RAP_NO
             1           2          5
             1           4          5
             1           5          5
             1           1          5
             2           4          7
             2           6          7
             2           7          7
             3           8         10
             3          10         10
             4           3          7
             4           7          7Doesn't this give you the correct results?

  • Need to modify the query

    Hi All,
    I am a new DBA. Please help me in modifying the below query in test envirnoment. It is long query.
    SELECT NVL(MIN(P_LAY),0), NVL(MIN(TID),0), NVL(MIN(TTIME),0), NVL(MIN(TSOURCE),0) FROM ( SELECT P_LAY, TID, TTIME, TSOURCE FROM ( SELECT (CASE WHEN T1.INTERNAL_TYPE=3 THEN -1 ELSE T_REPORT.GET_LAY(T1.EVE_ID, T1.EVE_TIME,:B4 ) END ) P_LAY, T1.EVE_ID TID, T1.EVE_TIME TTIME, T1.ALA_SOURCE_ID TSOURCE FROM T_EVE_LOG T1, T_EVE_LOG T2 WHERE T1.ALA_ID = T2.ROOT_ALA_ID AND T2.EVE_TIME >= :B3 AND T2.EVE_TIME < :B2 AND T2.ALA_ID = :B1 AND T2.ACT_ID IN (2,5) ) ORDER BY P_LAY ) WHERE ROWNUM = 1
    Thanks in Advance

    886755 wrote:
    Hi All,
    I am a new DBA. Please help me in modifying the below query in test envirnoment. It is long query.
    SELECT NVL(MIN(P_LAY),0), NVL(MIN(TID),0), NVL(MIN(TTIME),0), NVL(MIN(TSOURCE),0) FROM ( SELECT P_LAY, TID, TTIME, TSOURCE FROM ( SELECT (CASE WHEN T1.INTERNAL_TYPE=3 THEN -1 ELSE T_REPORT.GET_LAY(T1.EVE_ID, T1.EVE_TIME,:B4 ) END ) P_LAY, T1.EVE_ID TID, T1.EVE_TIME TTIME, T1.ALA_SOURCE_ID TSOURCE FROM T_EVE_LOG T1, T_EVE_LOG T2 WHERE T1.ALA_ID = T2.ROOT_ALA_ID AND T2.EVE_TIME >= :B3 AND T2.EVE_TIME < :B2 AND T2.ALA_ID = :B1 AND T2.ACT_ID IN (2,5) ) ORDER BY P_LAY ) WHERE ROWNUM = 1
    Thanks in Advancemodify it how to do what?
    SELECT Nvl(MIN(p_lay), 0),
           Nvl(MIN(tid), 0),
           Nvl(MIN(ttime), 0),
           Nvl(MIN(tsource), 0)
    FROM   (SELECT p_lay,
                   tid,
                   ttime,
                   tsource
            FROM   (SELECT ( CASE
                               WHEN t1.internal_type = 3 THEN -1
                               ELSE t_report.Get_lay(t1.eve_id, t1.eve_time, :B4)
                             END )          p_lay,
                           t1.eve_id        tid,
                           t1.eve_time      ttime,
                           t1.ala_source_id tsource
                    FROM   t_eve_log t1,
                           t_eve_log t2
                    WHERE  t1.ala_id = t2.root_ala_id
                           AND t2.eve_time >= :B3
                           AND t2.eve_time < :B2
                           AND t2.ala_id = :B1
                           AND t2.act_id IN ( 2, 5 ))
            ORDER  BY p_lay)
    WHERE  ROWNUM = 1 

  • Modifying the sql query in doDML of entity

    I am using Jdev 11.1.1.4.0 and SQLServer Database
    I want to modify the sql query in "doDML(int operation, TransactionEvent e)"
    I could check what kind of operation like (operation == DML_UPDATE) and do some additional stuff.. But I want to edit the query because of which we entered doDML..
    I want to edit the query because when i use SQLServer database with SQLBuilder as SQL92, the update statement will have table alias like "update table <table alias>" which the SQLServer is not recognizing.. So I want to remove that alias from sql query in doDML..

    It isn't possible.
    However as per the following MSDN page a table alias is fine in an UPDATE statement so are you sure this is your problem?: http://msdn.microsoft.com/en-us/library/aa260662(v=sql.80).aspx
    CM.

  • Modify the query

    Is ther any otherway i can modify the below query to create emp_target to get the expected result below at the end
           CREATE EMP_TARGET as      
      SELECT emp.empno,emp.ename, emp.deptNO,dept.dname,EMP.mod_time,dept.mod_time FROM   
         (SELECT * FROM EMP WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY'))emp
         left join
            (select * from dept WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY') ) dept    
          on 
          emp.DEPTNO=dept.DEPTNO
    CREATE TABLE EMP
            EMPNO        INT            NOT NULL    ,
            ENAME        VARCHAR(10)                ,
            JOB            VARCHAR(9)                ,
            MGR            INT                        ,
            SAL            NUMERIC(7,2)                ,
            DEPTNO        INT,
            mod_time date
    CREATE TABLE DEPT
            DEPTNO    INT,
            DNAME    VARCHAR(14),
            LOC        VARCHAR(13) ,
            mod_time    date
          INSERT INTO emp VALUES
                (7369, 'SMITH', 'CLERK', 7902, 800, 20,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7499, 'ALLEN', 'SALESMAN', 7698, 1600, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7521, 'WARD', 'SALESMAN', 7698, 1250, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7566, 'JONES', 'MANAGER', 7839, 2975, 20,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7654, 'MARTIN', 'SALESMAN', 7698, 1250, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7698, 'BLAKE', 'MANAGER', 7839, 2850, 30,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7782, 'CLARK', 'MANAGER', 7839, 2450, 10,to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7788, 'SCOTT', 'ANALYST', 7566, 3000, 20,to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7839, 'KING', 'PRESIDENT', NULL, 5000, 10,to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7844, 'TURNER', 'SALESMAN', 7698, 1500, 30,to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7876, 'ADAMS', 'CLERK', 7788, 1100, 20,to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7900, 'JAMES', 'CLERK', 7698, 950, 30,to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7902, 'FORD', 'ANALYST', 7566, 3000, 60,to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO EMP VALUES
                (7934, 'MILLER', 'CLERK', 7782, 1300, 10,to_DATE('01-SEP-2012','DD-MON-YYYY'));
                SELECT * FROM EMP
            INSERT INTO DEPT
                VALUES (10, 'ACCOUNTING', 'NEW YORK',to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO DEPT
                VALUES (20, 'RESEARCH', 'DALLAS',to_DATE('31-JUL-2012','DD-MON-YYYY'));
            INSERT INTO DEPT
                VALUES (30, 'SALES', 'CHICAGO',to_DATE('01-SEP-2012','DD-MON-YYYY'));
            INSERT INTO DEPT
                VALUES (40, 'OPERATIONS', 'BOSTON',to_DATE('01-SEP-2012','DD-MON-YYYY'));
                SELECT * FROM DEPT
           CREATE EMP_TARGET as      
      SELECT emp.empno,emp.ename, emp.deptNO,dept.dname,EMP.mod_time,dept.mod_time FROM   
         (SELECT * FROM EMP WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY'))emp
         left join
            (select * from dept WHERE MOD_TIME <=to_date('31-JUL-2012','DD-MON-YYYY') ) dept    
          on 
          emp.DEPTNO=dept.DEPTNO
    Emp_target expected result
    empno ename  deptno  dname         emp_mod_time            dept_mod_time
    7782     CLARK     10     ACCOUNTING     31-JUL-12     31-JUL-12
    7566     JONES     20     RESEARCH         31-JUL-12     31-JUL-12
    7369     SMITH     20     RESEARCH             31-JUL-12     31-JUL-12
    7698     BLAKE     30                         31-JUL-12     
    7654     MARTIN     30                          31-JUL-12     
    7521     WARD     30                          31-JUL-12     
    7499     ALLEN     30                          31-JUL-12     Edited by: choti on Jan 8, 2013 10:20 AM

    Hi,
    choti wrote:
    CREATE TABLE EMP
    EMPNO        INT            NOT NULL    ,
    ENAME        VARCHAR(10)                ,
    JOB            VARCHAR(9)                ,
    MGR            INT                        ,
    SAL            NUMERIC(7,2)                ,
    DEPTNO        INT,
    mod_time date
    Thanks for posting the CREATE TABLE and INSERT statements.
    Remember why you need to go to all that trouble: so the people who want to help you can re-create the problem and test their ideas. If you post statements that don't work, then people can't use them. Please test (and, if necessary, correct) your statements before you post them.
    There is no NUMERIC datatype in Oracle SQL. I think you meant the datatype of sal to be NUMBER.
    Here's one way to create the emp_target table:
    CREATE TABLE     emp_target
    AS
    SELECT  e.empno
    ,     e.ename
    ,     e.deptno
    ,     d.dname
    ,     e.mod_time     AS emp_mod_time
    ,     d.mod_time     AS dept_mod_time
    FROM           emp        e
    LEFT OUTER JOIN  dept     d   ON   d.deptno     = e.deptno
                                   AND      d.mod_time     <= TO_DATE ('31-JUL-2012','DD-MON-YYYY')
    WHERE     e.mod_time     <= TO_DATE ('31-JUL-2012','DD-MON-YYYY')
    ;

  • Need single record for single period. Modify the select query.

    Requirement
    THere are 6 programs for each company for each billing period. If anyof the program for one billing period and period_balance>0 then display outstanding balance YES. if period_balance <=0 for all the programs for one period then outstanding balance=NO
    Below is the query i have used but i have to modify the query to get single record for each period whether outstandignbalance yes or no. Please help to resolve this issue. OR modify the query.
    select distinct B_Billing_key, B_COMPANY_ID company ,
    to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
    trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
    Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) lastPaymentdate,
    SURCH_AMOUNT,ADJUST_AMOUNT,PI_AMOUNT,AMOUNT,
    (nvl(SURCH_AMOUNT,0)+nvl(ADJUST_AMOUNT,0)+nvl(PI_AMOUNT,0))-(nvl(sum(AMOUNT),0))"Period_Balance",
    decode(sign((nvl(SURCH_AMOUNT,0)+nvl(ADJUST_AMOUNT,0)+nvl(PI_AMOUNT,0))-(nvl(sum(AMOUNT),0))),1, 'Yes'
    ,'No'
    ) outstandingbalance
    p.PROGRAM_NAME_ID programname
    FROM tuff_balance_view,MV_PROG_SURCH S,MV_PAYMENT_HOLDING H,MV_PROGRAM_DICT P where
    b_company_id = 'U-7052-C'
    and B_Billing_key=s.BILLING_KEY
    and S.PROGRAM_KEY = P.PROGRAM_KEY
    and P.PROGRAM_KEY= H.PROGRAM_KEY
    GROUP BY B_Billing_key,B_COMPANY_ID,B_REPORT_PERIOD,SURCH_AMOUNT,ADJUST_AMOUNT,PI_AMOUNT,PROG_SURCH_KEY,
    S.PROGRAM_KEY,p.PROGRAM_NAME_ID,AMOUNT
    order by B_Billing_key desc
    B_Billing_key is the primary key. I am looking for the output only one record for each biling perid. there are 6 programs for each billing period. if any of the program has period balance >0 then outstanding balance should be yes. For sample i am giving 2 programs.
    Actual output from the above
    biling_key company billing period period_balance outstandingbalance programname
    123 xyz January 2011 $4 Yes ABC
    123 xyz January 2011 $-5 NO DEF
    456 xyz February 2011 $-3 NO ABC
    456 xyz February 2011 $- 2 NO DEF
    Need the output as below from the above query. Can you please help to simplify query. If anyof theprogram having outstanding balance for that particular period show the outstandigbalance as yes. Else NO.
    Expected output as below
    company billing period outstandingbalance programname
    xyz January 2011 Yes ABC
    xyz February 2011 No DEF
    Thanks,
    vi

    Hi G,
    With the same query i am gettting outs as NO for all months which is not true. can you pelase look at the following data.
    SELECT DISTINCT B_BILLING_KEY,
    to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
    trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
    B_company_id company,
    sum((nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))) "PeriodBalance",
    Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) LastPaymentDate,
    decode(sign(
    (nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))), 1,'Yes','No') Outs
    FROM mv_program_dict P, tuff_balance_view T WHERE
    b_company_id = 'U-7052-C' group by B_REPORT_PERIOD,B_company_id,B_BILLING_KEY,B_ORG_SURCH_AMOUNT,
    B_ORG_PI_AMOUNT,P_AMOUNT
    order by B_BILLING_KEY desc
    Actual
    Billing key Billing company periodbalance lastpayment date outs
    110631534073     November 2010     U-7052-C     270          Yes
    110631534073     November 2010     U-7052-C     690          Yes
    110631534073     November 2010     U-7052-C     66          Yes
    110461533197     October 2010     U-7052-C     4740          Yes
    110461533197     October 2010     U-7052-C     27000          Yes
    110461533197     October 2010     U-7052-C     0          No
    110251532527     September 2010     U-7052-C     0     09/13/10     No
    110251532527     September 2010     U-7052-C     0          No
    110251532527     September 2010     U-7052-C     -18     09/13/10     No
    110251532484     August 2010     U-7052-C     0     09/13/10     No
    110251532484     August 2010     U-7052-C     2001     09/13/10     Yes
    110251532484     August 2010     U-7052-C     0          No
    Expectedoutput(need only following columns)
    Billing key Billing company lastpayment date outs
    110631534073     November 2010     U-7052-C               Yes
    110461533197     October 2010     U-7052-C               Yes
    110251532527     September 2010     U-7052-C          09/13/10     No
    110251532484     August 2010     U-7052-C          09/13/10     YES
    By using below query i am getting all output as NO. HOw to modify it.
    SELECT company,
    billing,LastPaymentDate,
    CASE
    WHEN SUM (DECODE (outs, 'YES', 1, 0)) > 0 THEN 'YES'
    ELSE 'NO'
    END Outstanding
    FROM (
    SELECT DISTINCT B_BILLING_KEY,
    to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
    trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
    B_company_id company,
    sum((nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))) "PeriodBalance",
    Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) LastPaymentDate,
    decode(sign(
    (nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))), 1,'Yes','No') Outs
    FROM mv_program_dict P, tuff_balance_view T WHERE
    b_company_id = 'U-7052-C' group by B_REPORT_PERIOD,B_company_id,B_BILLING_KEY,B_ORG_SURCH_AMOUNT,
    B_ORG_PI_AMOUNT,P_AMOUNT
    order by B_BILLING_KEY desc)
    GROUP BY company, billing,LastPaymentDate;
    Note:in the actual out put max(lastpayment date) is returing null values. if there is any date in one billing return that date only remove null example is september. in september it should return only 09/13/10 this date not null date. but if there is no other within one biling then consider that as null example november..
    Thanks,
    v

  • How to avoid to modify the input value in a query

    Hi expert,
    in a Bex query (vers. 7.1), I created an auth variable on 0sales_off object to limit the display of data on a specific agency and it works right!
    But the user can anyway modify the enter value and insert manually another agency into a filter or into the start selection, and even if in this case the query result is not displayed (cause to auth variable), I'd like that the user cannot modify the value authorized agency.
    The auth. variable is set as single value, optional and ready for input and I cannot make the variable as invisible for the start input, because there are users authorized to enter any values without restrictions​​.
    is there a solution for my issue?
    Thanks for your support.
    Claudia

    Hi Claudia,
    I think you will not have any other option as you need to show the variable for specific users and still you need it to accept input.
    As I know you can not hide the variable display for specific users.
    Regards,
    Durgesh.

  • How can I modify the display field names on the output port of my bi query

    Hello,
    I integrate my bi query in the visual composer storyboard.
    Then I click on my output port of the query and see the output fields.
    The display field names are very strange.
    For example:
    ABZCNQMDOPWJGHS1Q5Q27090
    I have never save such a field name while I create my query in the query designer.
    Have somebody an idea, where I can modify my displayed field names??
    Thanks.
    Thomas

    Hi Thomas,
    the cryptical names are the technical names of your query components. If there is no decription available (depends also on your portal language) then the technical names are displayed. Check your portal language in your user settings and then check if you have entered a description in the query designer for this language.
    Best Regards,
    Marcel

  • Modifying the text "Result" and "Overall Result" in a BEx query output

    Hi,
    1) Is it possible to modify the text "Result", "Overall Result" which appears in the sub-total and grand total lines of BEx query output? I do not see any related setting the properties area of the object in BEx Query designer. Do I have to write some VB code or can I do something in Customer Exits?
    Also my client wants that this text need to be made dynamic such as "Sub-Total for the month of Jan 2006".
    I can use work book option and change the texts manually.But this is not meeting my clients requirement.
    2)Is it possible to have dynamic title text for a BEx query?
    We are on BW 3.5 & if any of you could provide / guidance to the above issue.
    Thanks,
    Venkatram

    You will have to use VB Macros to change the text "Result" and "Overall Result", there is not settings in the query designer for the same.
    You can have dynamic descriptions for queries using text variables like Expense Query for month of Jan 2006, if user selected Jan 2006.
    Thanks.

Maybe you are looking for

  • How do I reset an app's icon so the app will launch?

    In a test user account, everything is fine. In my main account, however, the Photoshop icon is now a blank document icon and Finder says it is a Microsoft Word document rather than an application. If I double click on a Photoshop data file, Photoshop

  • How to create an External Alias for a Portal URL ?

    Hi Gurus, Can anybody tell me how to create an external alias for a portal link(URL). Actually, my problem is i want to send this Portal URL(link) thru' a SendMail step to the user so that when he clicks on it, it will take him to his UWL(Ofcourse af

  • Problem Please open the Vi named popup

    Hello I have a problem opening a certain vi when I open a vi lets say "Main.vi" labview popsup a "Please select the vi named: Main.vi" this is a little strange for me. normaly you gets this message if a certain subvi or control cannot be findt in the

  • Error in icon association

    Hi community! I have a Macbook pro retina late 2014 with Yosemite 10.10.1 I am having a problem with icon association. I installed Shimo then Tunnelblick. After that I remove Shimo (I decide not to use it). Remove: Shimo.app Shimo Applicacion Support

  • Premiere pro cc 2014 problems with audio

    I have edited some sequences in premiere using sony xdcam ex clips. The clips where recorded as 1080 50i. I have edited it in the same sequence properties as premiere sugested it. All there is fine and audio is playing well. The problem strats when i