Modifying the query
The relational model for the database is:
Department(DeptNum, Descrip, Instname, DeptName, State, Postcode)
Academic(AcNum, DeptNum, FamName, GiveName, Initials, Title)
Paper(PaNum, Title)
Author(PaNum, AcNum)
Field(FieldNum, ID, Title)
Interest(FieldNum, AcNum, Descrip)
What are the number of academics who have written more than the overall average number of
papers per academic.
The average number of papers per academic is the total number of papers
divided by the total number of academics
I do know how to get the list of the academics who have written more than the average number of papers but adding all the academics in the list is what I want to do.
My query
select au.acnum,count(*) as papers
from author au,paper p,academic a
group by au.acnum
having count(*)>(count(p.panum)/count(a.acnum))
See if this will hlep you.
select aut.acnum
, count(*) as papers
from department dep
, academic aca
, author aut
, paper pap
where dep.deptnum = aca.deptnum
and aca.acnum = aut.acnum
and aut.panum = pap.panum
group aut.acnum
having count(*)>(count(pap.panum)/count(aca.acnum))
Lrovedo..
Similar Messages
-
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.. -
Pls help me to modify the query for performance improvement
Hi,
I have the below initialization
DECLARE @Active bit =1 ;
Declare @id int
SELECT @Active=CASE WHEN id=@id and [Rank] ='Good' then 0 else 1 END FROM dbo.Students
I have to change this query in such a way that the conditions id=@id and [Rank] ='Good' should go to the where condition of the query. In that case, how can i use Case statement to retrieve 1 or 0? Can you please help me to modify this initialization?I dont understand your query...May be below? or provide us sample data and your output...
SELECT * FROM dbo.students
where @Active=CASE
WHEN id=@id and rank ='Good' then 0 else 1 END
But, I doubt you will have performance improvement here?
Do you have index on id?
If you are looking for getting the data for @ID with rank ='Good' then use the below:Make sure, you have index on id,rank combination.
SELECT * FROM dbo.students
where id=@id
and rank ='Good' -
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
anandhai 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 replyCan 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? -
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 Advance886755 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 -
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 AMHi,
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')
; -
How to modify the query to get max id record
Hi All,
How to modify below query to get proper result.The query is returning some records are duplicated.I need only one record to display from duplicate based on max assetid.
Here is my query:
SELECT *
FROM (
SELECT a.uppertitle, a.composer, a.esongid,
MAX (asset_new.assetid) AS assetid,asset_new.ownerid
FROM (SELECT DISTINCT NVL (esong.title, '~') AS uppertitle,
INITCAP (NVL (esong.composer, '~')
) AS composer,
esong.esongid
FROM esong, esongcountry_us eus
WHERE 1 = 1
AND eus.esongid = esong.esongid
AND eus.isocountrycode IN ('US')
AND esong.title LIKE 'LIVE TO TELL%'
AND ROWNUM < 390) a,
songwebrecording,
recordingasset_new,
asset_new
WHERE a.esongid = songwebrecording.esongid(+)
AND songwebrecording.recordingid = recordingasset_new.recordingid(+)
AND recordingasset_new.assetid = asset_new.assetid(+)
GROUP BY a.uppertitle, a.composer, a.esongid,asset_new.ownerid)
WHERE ROWNUM <= 390
ORDER BY uppertitle
result:
upperlittle composer esongid assetid onwerid
1. LIVE TO TELL Gelb, Howe 480340000 null null
2. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 null null
3. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3080366 null
4. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3038107 null
5. LIVE TO TELL THE TALE Holopainen 859841500 nulll nulll
I need the result like this :
upperlittle composer esongid assetid onwerid
1. LIVE TO TELL Gelb, Howe 480340000 null null
2. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3080366 null
3. LIVE TO TELL THE TALE Holopainen 859841500 nulll nulll
Please help me on this regard. oracle version is 9i
Regards,
Rajasekharcan you please format your code with
-
Can i modify the query in discoverer
Hi
I am working on discoverer vierwer, is it possible to change the query and run the query myself. I can access the query but i can't make any changes.
The problem i am having is i want to show the sum of a variable but not show the count, is this possible ?
any help would be appreciated
thanks
nimeshHi Nimesh
Presumably the workbook you are referring to is not owned by you and has only been shared with you? In this case, while you can make changes to the query while it is in memory, providing you have the necessary privileges that is, you will not be able to save over the original. This is because only the owner can do this and you are not the owner.
What you can do though is to use Save As and save ourself a variant of the report. Of course this opens up another spoke in the wheel of reinvented queries, something that most organizations would like to avoid.
Therefore, perhaps the best option would be to contact the owner of the workbook and request that it be modified for your needs.
I hope this helps
Best wishes
Michael Armstrong-Smith
URL: http://learndiscoverer.com
Blog: http://learndiscoverer.blogspot.com -
How to modify the query to get the output in a single row
Hi All,
Below is the query i have written it works fine
select DISTINCT right(left(CTACCT,13),4) AS LocationNum,
tODS_GLBalance.FiscalYearId AS FiscalYearId,
tODS_GLBalance.FiscalMonthOfYearId AS FiscalMonthOfYearId,
--tods_GLMetadata.Metric,
Case when
tods_GLMetadata.Metric = 'Gross Margin'
Then SUM(Balance)
Else 0
END AS GrossMargin,
Case when
tods_GLMetadata.Metric = 'Occupancy'
Then SUM(Balance)
Else 0
END AS Occupancy,
Case when
tods_GLMetadata.Metric = 'Payroll Dollars'
Then SUM(Balance)
Else 0
END AS Payroll,
Case when
tods_GLMetadata.Metric = 'CF Sales'
Then SUM(Balance)
Else 0
END AS OperatingSales,
Case when
tods_GLMetadata.Metric = 'Operations'
Then SUM(Balance)
Else 0
END AS OperatingExpenses
-- 0 as payroll
from ods.[JJill].[tODS_GLBalance]
inner join ods.Staging.tODS_INF_GLPCT ON tODS_GLBalance.PageNum = tODS_INF_GLPCT.CTPAGE
inner join ods.JJill.tods_GLMetadata ON tods_GLMetadata.AcctDescription = tODS_INF_GLPCT.CTDESC
where
(tODS_GLBalance.FiscalYearId = 2012) and
(tODS_GLBalance.FiscalMonthOfYearId = 2) and
(right(left(CTACCT,13),4)= 3020)
group by
right(left(CTACCT,13),4),
tODS_GLBalance.FiscalYearId,
tODS_GLBalance.FiscalMonthOfYearId,
tods_GLMetadata.Metric
This is the sample output,
LocationNum FiscalYearId FiscalMonthOfYearId GrossMargin Occupancy Payroll OperatingSales OperatingExpenses
3020 2012 2 -112477.00 0.00 0.00 0.00 0.00
3020 2012 2 0.00 0.00 0.00 -158288.94 0.00
3020 2012 2 0.00 0.00 0.00 0.00 5625.44
3020 2012 2 0.00 0.00 24185.79 0.00 0.00
3020 2012 2 0.00 31075.53 0.00 0.00 0.00
But, i am expecting the output to be something like this
LocationNum FiscalYearId FiscalMonthOfYearId GrossMargin Occupancy Payroll OperatingSales OperatingExpenses
3020 2012 2 -112477.00 31075.53 24185.79 -158288.94 5625.44
Can someone please help me with changing my query to get the desired output?
Please let me know if you have any questions.
ThanksTry this:
SELECT DISTINCT
RIGHT(LEFT(CTACCT,13),4) AS LocationNum, tODS_GLBalance.FiscalYearId AS FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId AS FiscalMonthOfYearId,
SUM(CASE WHEN tods_GLMetadata.Metric = 'Gross Margin' THEN Balance ELSE 0 END ) AS GrossMargin,
SUM(CASE WHEN tods_GLMetadata.Metric = 'Occupancy' THEN Balance ELSE 0 END ) AS Occupancy,
SUM(CASE WHEN tods_GLMetadata.Metric = 'Payroll Dollars' THEN Balance ELSE 0 END ) AS Payroll,
SUM(CASE WHEN tods_GLMetadata.Metric = 'CF Sales' THEN Balance ELSE 0 END ) AS OperatingSales,
SUM(CASE WHEN tods_GLMetadata.Metric = 'Operations' THEN Balance ELSE 0 END ) AS OperatingExpenses
FROM ods.[JJill].[tODS_GLBalance]
INNER JOIN ods.Staging.tODS_INF_GLPCT
ON tODS_GLBalance.PageNum = tODS_INF_GLPCT.CTPAGE
INNER JOIN ods.JJill.tods_GLMetadata
ON tods_GLMetadata.AcctDescription = tODS_INF_GLPCT.CTDESC
WHERE tODS_GLBalance.FiscalYearId = 2012
AND tODS_GLBalance.FiscalMonthOfYearId = 2
AND RIGHT(LEFT(CTACCT,13),4) = 3020
GROUP BY right(left(CTACCT,13),4), tODS_GLBalance.FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId, tods_GLMetadata.Metric -
Report conversion tool--Can we modify the query
Hi all,
I have some freehand SQL reports converted into WebI reports. I understand that report conversion tool, creates a new universe for each of the freehand SQL report. But if I try to edit the query, like add a filter condition, an error pops out.
Is it possible to edit the query if we convert freehand sql reports into webi reports?
Regards
Ash.Hi,
Yes it is possible to edit the query for the converted free hand sql query.
If you see any problem while editing the SQL of the converted report, do a refresh once and try.
Adding query filter also works fine.
Issue from your end could also be due to security settings.i advise to revisit the security once and make sure all appropriate rights are available for the user.
Thanks,
Sri -
Modify the query in some other way
sorry worng post
Edited by: most wanted!!!! on Oct 11, 2011 6:16 AMHi kalam,
Maybe I did not understood correctly, but I understand that he want to get the columns names dynamically, am I wrong? did you understood differently?
"Without actually typing all the fields for different tables?"
* If each table was with different columns then using simple query like this will do the job:
select * from t1
FULL OUTER JOIN t2 on 1=2
but if there is a column C which is in both tables then in this solution you will get it twice. Therefore there is need another step or to build the columns names dynamically.
for example if he have this DDL+DML
create table t1 (x1 int, x2 int,c int)
create table t2 (y1 int, y2 int, y3 int,c int)
GO
insert t1 values (1,1,6),(1,2,6),(1,3,6),(1,4,6)
insert t2 values (11,11,33,6),(11,12,33,6),(11,13,33,6),(11,14,33,6)
GO
then the result should be (without using the column's names in the query):
x1 x2 c y1 y2 y3
1 1 6 NULL NULL NULL
1 2 6 NULL NULL NULL
1 3 6 NULL NULL NULL
1 4 6 NULL NULL NULL
NULL NULL 6 11 11 33
NULL NULL 6 11 12 33
NULL NULL 6 11 13 33
NULL NULL 6 11 14 33
FARAZ
A QURESHI, Is this not what you are trying to get?
am I right that you want to get it without using any column name?
[Personal Site] [Blog] [Facebook] -
When i run the following query,
select row_wid,
case when X_ACT_TYPE in ('Install','3Ph Batt Replacement') then 'FLAG_1'
when (x_act_type ='Maintenance' and X_act_subtype = 'Break Fix') then 'FLAG_2'
When (x_act_type ='Maintenance' and X_act_subtype = 'Preventive Maintenance') then 'FLAG_3'
else 'FLAG_4' end as FLAG_TYPE
from anl_crm_rmw.wc_activity_d
my value for flag_type is always Flag_4. It is not able to find other types.
Is there any problem in query. Pls guide me.I am getting the following error ORA-00933, when i use the following query,
select a.row_wid,
case when a.X_ACT_TYPE = 'Install' then 'FLAG_1'
when a.X_ACT_TYPE = '3Ph Batt Replacement' then 'FLAG_1'
when a.X_ACT_TYPE = 'Customer Training' then 'FLAG_1'
when a.X_ACT_TYPE = 'Product Substuition' then 'FLAG_1'
when a.X_ACT_TYPE = 'Customer Commercial Support' then 'FLAG_1'
when (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break Fix') then 'FLAG_2'
when (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break/Fix') then 'FLAG_2'
when (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break Fix/Corrective Maint') then 'FLAG_2'
when (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break Fix-Corrective Maint') then 'FLAG_2'
When (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'Preventive Maintenance') then 'FLAG_3'
When (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'System Removal') then 'FLAG_3'
When (a.x_act_type = 'Maintenance' and a.X_act_subtype = 'Standby') then 'FLAG_3'
else 'FLAG_4' end as FLAG_TYPE,
C.wrnty_end_dt
from anl_crm_rmw.wc_activity_d A,
anl_crm_rmw.wc_activity_F B,
anl_crm_rmw.w_asset_d C
where A.ROW_WID = B.ROW_WID
and B.ASSET_WID = C.ROW_WID
and a.row_wid = 2088219
group by A.row_wid, case when A.X_ACT_TYPE = 'Install' then 'FLAG_1'
when A.X_ACT_TYPE = '3Ph Batt Replacement' then 'FLAG_1'
when A.X_ACT_TYPE = 'Customer Training' then 'FLAG_1'
when A.X_ACT_TYPE = 'Product Substuition' then 'FLAG_1'
when A.X_ACT_TYPE = 'Customer Commercial Support' then 'FLAG_1' end
when (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break Fix') then 'FLAG_2'
when (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break/Fix') then 'FLAG_2'
when (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break Fix/Corrective Maint') then 'FLAG_2'
when (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'Break Fix-Corrective Maint') then 'FLAG_2'
When (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'Preventive Maintenance') then 'FLAG_3'
When (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'System Removal') then 'FLAG_3'
When (A.x_act_type = 'Maintenance' and a.X_act_subtype = 'Standby') then 'FLAG_3'
else 'FLAG_4' end -
Passing item to pl/sql to modify the query
hi all,
i am new to apex and appreciate any help :)
what i am trying to do do is show point of interest on the map, and filter them :)
what i already have done:
i have a page.1 where is a list and when you click the link it sent you to page.2 with 3 items, "type" start date "end date"
type is well the type of point :)
start date and end date are today's dates that are pulled from db when clicked
when page.2 opens i can see the 3 items on the page
the page body loads a pl/sql procedure which:
pl/sql code on page.2
"begin item_locations; end;"
queries the database and returns the
"type" "lat,long" "date" "id"values from different tables
example;
id type lat,long date
coffe 2 40.386289,49.824348 5 07-OCT-12 10.37.54.000000 PM
tea 2 40.386289,49.824348 5 07-OCT-12 10.37.54.000000 PM
food 2 40.386289,49.824348 5 07-OCT-12 10.37.54.000000 PM
cars 1 40.386289,49.824348 5 07-OCT-12 10.37.54.000000 PM
bars 3 40.386289,49.824348 5 07-OCT-12 10.37.54.000000 PM
shops 6 40.386289,49.824348 5 07-OCT-12 10.37.54.000000 PM
then the procedure takes outputs as "htp.print" and creates a map and show ALL the points,
i want to do 2 things
1) i want to filter whats shown on the page by type and date when the page loads (assuming user coming from page.1 with the items full :) )
my idea is to add "where type=**type from page.2 item** and date **page item date1** between **page item date2**
2) add a button so and if i manually input/modifiy the page items on page2. them click the button will have new results :)
by setup:
win8 64 bit
oracle db expres
Application Express 4.0.2.00.09
thanks in advancceSounds like an interesting application!
The easiest way to do this would be to change your procedure item_locations to include the three parameters you want to use, so that your procedure looks like:
PROCEDURE item_locations
(p_type VARCHAR2 DEFAULT NULL
,p_start_date DATE DEFAULT NULL
,p_end_date DATE DEFAULT NULL)
IS ...
BEGIN
Select col1, col2, col3
from my_table
where type = NVL(p_type,type)
and my_date between NVL(p_start_date,my_date) and NVL(p_end_date,my_date)
htp.p(my_data)
END item_locations;
etc
-- Note - this is purely example code and not intended to compile as is. Just saying.Then in your apex page process, you simply call
BEGIN
item_locations (:P2_ITEM, :P2_START_DATE, :P2_END_DATE);
END;I hope this makes sense. It sounds like you're so new that you have not had the pleasure of doing the 2 Day Developer Guide. I would strongly recommend you do this if you are not familiar with Apex - it is a necessity.
Kind Regards, Pete -
ADF BC: modifying VO bind params before executing the query
Hi gang
I've a use case in ADF BC where I need to modify View Object bind parameters (eg. convert strings to uppercase) entered by users to change the result of the underlying VO query, and show the modified bind parameters to the user after the query.
Normally I would do this in the VO query by modifying the query where clause with the appropriate SQL. However this method is not applicable in this specific use case as the user doesn't get to see the modified bind parameters as a result.
I've thought about a few options including:
1) Generating the bind parameter accessors for the ViewObjectImpl and overriding the bind parameter setters to convert all string values to uppercase. This wasn't suitable as it looks like ADF Faces RC doesn't make use of the accessors via the default ADF bindings.
2) Overriding the applyViewCriteria() method in the ViewObjectImpl - which however isn't appropriate as it applies to search fields entered as view criteria, not bind parameters.
3) Overriding the executeQueryForCollection() method in the ViewObjectImpl - I thought I was on a winner here as I could retrieve the bind parameters via a call to getNamedWhereClauseParams(), modify the bind params and then call setNamedWhereClauseParams() to set them back. Unfortunately to really set the params I then need to call executeQuery() inside executeQueryForCollection() which puts the VO in a loop. You can see my sample code below:
@Override
protected void executeQueryForCollection(Object queryCollection,
Object[] bindParams,
int noUserParams) {
AttributeList bindParamList = getNamedWhereClauseParams();
String[] bindParamNames = bindParamList.getAttributeNames();
Object[] bindParamValues = bindParamList.getAttributeValues();
boolean valueChange = false;
if (bindParamNames != null && bindParamValues != null) {
String bindParamName = null;
Object bindParamValue = null;
for (int i = 0, j = bindParamNames.length; i < j; i++) {
bindParamName = bindParamNames;
bindParamValue = bindParamValues[i];
if (bindParamName != null && !bindParamName.equals("")) {
if (bindParamValue instanceof String) {
if (bindParamValue != null && !bindParamValue.equals("")) {
bindParamList.setAttribute(bindParamName, (Object)((String)bindParamValue).toUpperCase());
valueChange = true;
} // else do nothing; null String
} // else do nothing; only interested in converting Strings to upper case
} // else do nothing; bind parameter name is null
} // else do nothing; bind parameter name or value list is null
if (valueChange) {
setNamedWhereClauseParams(bindParamList);
// executeQuery(); // we can't do this; causes an infinite loop
super.executeQueryForCollection(queryCollection, bindParams, noUserParams);
I can think of a number of solutions/hacks in ADF Faces RC to get around this issue, but ideally I'd like to keep the solution in the model layer. Does anybody have a better idea of how I could do this? Your help appreciated.
Thanks & regards,
CM.
PS. JDev 11g Boxer 5188: ADF BC + ADF Faces RCHi Chris,
have you tried modifying the passed-in bindParams argument to work around the need to call executeQuery()?
That's what I would've done:
I would have set the named where clause params (like you do) and after that I would have tried to get a new parameters Object[] back by calling ViewRowSetImpl.getParametersAsStorageType() and pass that to the super call.
Sascha
Maybe you are looking for
-
Email no longer going to my blackberry
these last two days I recevied no emails to my blackberry. I though it was strange so i logged onto my email on my computer to see that I had unread mail that I had gotten in the last few days, but they were not sent to my phone. I didn't change any
-
IS there static variables in oracle 9i??
Hi, I have a requirement. I am establishing an orcale 9i connection from my .net application. Now I am calling an SP and it has a global count variable initialized to 0, and It fetches a count of * from one table and also there are other functionalit
-
OLAP DML program 10g Help!!
I have a OLAP DML program that I am invoking as follows call pmtdim_user_sec(_aw 'MG_OU' 'OPERATING_UNIT') The intent is to use the OPERATING_UNIT or parameter in 3rd place as a condition for cursor in the program. e.g. below for the sql for cursor.
-
Low Res files or no sound in Adobe Encore?? Please Help!
Okay, I have a project which is around 1h 30 and I am aiming to burn it to DVD However, I have tried exporting as MPEG2 for DVD from the premier pro presets and when imported into encore there is no sound on the timeline and the footage appears very
-
Display Autonumber from Access Database when click insert button
I have an application that displays all the customers in my Access database. The primary key is an Autonumber that Access generates. How can I display the autonumber that Access generates when I click my insert new record button?