PO_HEADERS_V return null rows
I want to make a report but problem is this when i query to PO_HEADERS_V. It shows null rows.
My current understanding is that you are viewing data in SQLPLUS/TOAD or some other similar tool. So you can initialize APPS before running the query on the View. Things should be okay. Can you please check the value returned by userenv('LANG') in your sqlplus and then pick the query of the PO_HEADERS_V and check the condition which causes the failure
Regards
Sumit
Similar Messages
-
Subquery not returning NULL rows
Hi,
I have been working with SQL since very long, but sorry, I have not come across following problem.
In the FROM clause, I use one sub query and a table. If I run sub query alone, it lists records even if rows with RATE=NULL.
But when I join sub query with other table, it is not fetching any records for RATE=NULL.
SELECT *
FROM
(SELECT key, perceivedseverity, eventtime, nvl(rate,'NA') rate FROM tr_alarm_history a
WHERE eventtime = (SELECT MAX(eventtime) FROM tr_alarm_history WHERE key = a.key)) a,
tr_lot_list b
WHERE a.key = b.localtargetname
and b.ttid='IM_20110516_8711' ;
The sub query -
" SELECT key, perceivedseverity, eventtime, nvl(rate,'NA') rate FROM tr_alarm_history a
WHERE eventtime = (SELECT MAX(eventtime) FROM tr_alarm_history WHERE key = a.key) "
returns all records including RATE=NULLs. But when I join them, RATE columns with NULL will be filtered. Please note that joining condition (WHERE a.key = b.localtargetname) is not a problem as they will always match irrespective of RATE having NULL.
Please let me know why this behaviour and is there any other alternative where in I can get the records even if RATE column is NULL.
Thanks a lot for your help.
-AnandI am extreemly sorry. 2 or 3 examples I took were wrong one's, which were not having RATE=NULL. So I got into such confusion.
PLEASE INORE MY QUESTION.
And thanks for your valuable time.
With Best Wishes,
-Anand -
Query with XMLTABLE returns null rows
Hello all,
I'm trying a query with XMLTABLE, but even thought the number of returned rows is correct, the row content is (null).
DB version is: 10.2.0.4.0
Here is my query;
SELECT s.DESCRIPTION
FROM EXECUTIONPLAN p,
XMLTABLE
('//executionPlan/executionPlanItems/summary'
PASSING p.DATA
COLUMNS
DESCRIPTION VARCHAR(250) PATH '/taskId'
) s
WHERE
trunc(extractValue(data, '/executionPlan/executionPlanHeader/statusChanged')) = to_date('2010-03-05','YYYY-MM-DD');Sorry the XML content is quite big -50k lines at average- so can't post the whole XML, but to give an idea;
/executionPlan
/executionPlan
/executionPlanHeader
/statusChanged
/x
/y
/executionPlanItems
/summary
/taskId
/summary
/summary
...The result looks like;
1 (null)
2 (null)
3 (null)
4 (null)
...Suggestions are very much appreciated :)
CheersHi guys,
Cracked it at last. It seems the column definition part does not like the forward slash in front of it. The following works;
SELECT s.DESCRIPTION
FROM EXECUTIONPLAN p,
XMLTABLE
( XmlNamespaces(DEFAULT 'http://www.staffware.com/frameworks/gen/valueobjects'),
'/executionPlan/executionPlanItems/summary'
PASSING p.DATA
COLUMNS
DESCRIPTION VARCHAR(250) PATH 'taskId'
) s
WHERE
trunc(extractValue(p.data, '/executionPlan/executionPlanHeader/statusChanged'
, 'xmlns="http://www.staffware.com/frameworks/gen/valueobjects"')) = to_date('2010-03-05','YYYY-MM-DD');I'm not sure if this is the way it is intended since it seems a bit weird to me and is not in line with the docs - or at least my understanding of them.
Thanks for taking the time to help out. Now on to coding :) -
Need Help :: Current row attribute value returning null
Hi Frds,
I am facing the problem that
Current row attribute value returning null............ even though value is there..... plz.. he
This is the code in PFR
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("queryBtn")!= null)
String pPersonId = pageContext.getParameter("ctrlPersonId");
String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
OptionsVORowImpl curRow = ( OptionsVORowImpl) am.findRowByRef(rowReference);
String dtlsItem = (String)curRow.getFlexValue(); /* this is returning null value */
/* here creating the hashmap and calling the page with the hashmap*/
Thanks & Regards,
jaya
Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810Hi Jaya,
You want to catch Flexfield values?
Try below code for catch value.
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("queryBtn")!= null)
OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
String dtlsItem = (String)Stylebean.getText(pageContext);
/* here creating the hashmap and calling the page with the hashmap*/
Thanks,
Dilip -
Null Pointer Exception when dynamic vo return no row.
Hi All,
i am using jedev version 11.1.1.5.0.
i have created one dynamic vo using application module method.
public void changeDynamicVoQuery(String sqlStatement) {
ViewObject dynamicVO = this.findViewObject("DynamicVo1");
if(dynamicVO!=null)
dynamicVO.remove();
dynamicVO = this.createViewObjectFromQueryStmt("DynamicVo1", sqlStatement);
try
dynamicVO.executeQuery();
catch(Exception ex)
System.out.println("Exception to execute Dynamic vo===>"+ex);
ex.printStackTrace();
}when i have passed query which return no row Null pointer Exception raised. and if query return row it is running fine.
log detail-
java.lang.NullPointerException
at oracle.adfinternal.view.faces.dynamic.AttributeHelper.getFilteredAttributeDefinitions(AttributeHelper.java:60)
at oracle.adfinternal.view.faces.dynamic.factories.TableFactory.create(TableFactory.java:95)
at oracle.adfinternal.view.faces.dynamic.DynamicTable.doCreateChildren(DynamicTable.java:117)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.createChildren(DynamicForm.java:456)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.encodeBegin(DynamicForm.java:280)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:682)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:601)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:358)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:682)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:601)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:358)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1273)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:800)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:294)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:214)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
<Feb 21, 2013 6:16:51 PM IST> <Error> <HTTP> <BEA-101020> <[ServletContext@14028564[app:DemoApp module:DemoApp-ViewController-context-root path:/DemoApp-ViewController-context-root spec-version:2.5]] Servlet failed with Exception
java.lang.NullPointerException
at oracle.adfinternal.view.faces.dynamic.AttributeHelper.getFilteredAttributeDefinitions(AttributeHelper.java:60)
at oracle.adfinternal.view.faces.dynamic.factories.TableFactory.create(TableFactory.java:95)
at oracle.adfinternal.view.faces.dynamic.DynamicTable.doCreateChildren(DynamicTable.java:117)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.createChildren(DynamicForm.java:456)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.encodeBegin(DynamicForm.java:280)
Truncated. see log file for complete stacktrace
>
<Feb 21, 2013 6:16:51 PM IST> <Notice> <Diagnostics> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'DefaultServer' has triggered at Feb 21, 2013 6:16:51 PM IST. Notification details:
WatchRuleType: Log
WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
WatchData: DATE = Feb 21, 2013 6:16:51 PM IST SERVER = DefaultServer MESSAGE = [ServletContext@14028564[app:DemoApp module:DemoApp-ViewController-context-root path:/DemoApp-ViewController-context-root spec-version:2.5]] Servlet failed with Exception
java.lang.NullPointerException
at oracle.adfinternal.view.faces.dynamic.AttributeHelper.getFilteredAttributeDefinitions(AttributeHelper.java:60)
at oracle.adfinternal.view.faces.dynamic.factories.TableFactory.create(TableFactory.java:95)
at oracle.adfinternal.view.faces.dynamic.DynamicTable.doCreateChildren(DynamicTable.java:117)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.createChildren(DynamicForm.java:456)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.encodeBegin(DynamicForm.java:280)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:682)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:601)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:358)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:682)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:601)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:358)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1273)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:800)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:294)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:214)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)It is very strange. what is wrong with my code? please help.
Thanks in Advance.one important thing is that when i drag dynamic vo in jspx page running fine. but when i used it on fragment page(jsff) then Null poiner exception occur.
i am using following tutorial to create dynamic table.
https://blogs.oracle.com/shay/entry/adf_faces_dynamic_tags_-fora
is there any solution?
error is following-
java.lang.NullPointerException
at oracle.adfinternal.view.faces.dynamic.DynamicForm.isRefreshNecessary(DynamicForm.java:503)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.createChildren(DynamicForm.java:370)
at oracle.adfinternal.view.faces.dynamic.DynamicForm.encodeBegin(DynamicForm.java:280)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer._encodeChildren(RegionRenderer.java:278)
at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer.encodeAll(RegionRenderer.java:201)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)And when i have refresh page it is running fine.
Edited by: Manish on २५ दिसंबर, २०१२ ६:२८ अपराह्न -
Silly old fogey (me) cannot figure out why this query returns 1 row
Hi all,
In reference to {thread:id=2456973}, why does
select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
, sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
from emp group by job;only return 1 row and not 1 for each job? I actually had to test it myself to believe it.
It returns data as if the query were
select sum(CLERKS), sum(SALESMANS)
from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
from emp group by job)Using only a single aggregate (either count or sum) returns 1 row per job, as expectedJohn Stegeman wrote:
It returns data as if the query were
select sum(CLERKS), sum(SALESMANS)
from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
from emp group by job)
Exactly the point ;-)
Seems like Oracle actually can do a "double group by" in the same operation.
Witness the explain plans in this example:
SQL> select count(decode(job, 'CLERK', 1, null)) CLERKS
2 , count(decode(job, 'SALESMAN', 1, null)) SALESMANS
3 from scott.emp group by job;
CLERKS SALESMANS
0 0
0 0
0 0
0 4
4 0
Execution Plan
Plan hash value: 1697595674
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5 | 40 | 4 (25)| 00:00:01 |
| 1 | HASH GROUP BY | | 5 | 40 | 4 (25)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 112 | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------And compare it to this one with the double aggregates:
SQL> select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
2 , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
3 from scott.emp group by job;
CLERKS SALESMANS
4 4
Execution Plan
Plan hash value: 417468012
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 8 | 4 (25)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 8 | 4 (25)| 00:00:01 |
| 2 | HASH GROUP BY | | 1 | 8 | 4 (25)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 112 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------There is both HASH GROUP BY and SORT AGGREGATE.
It does not really make sense to do an aggregate on an aggregate - if both aggregates are used "on the same group-by level".
The sum() aggregates are used upon an already aggregated value, so it does look like Oracle actually treats that as "first do the inner aggregate using the specified group by and then do the outer aggregate on the result with no group by."
Look at this example where I combine "double" aggregates with "single" aggregates:
SQL> select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
2 , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
3 , count(decode(job, 'SALESMAN', 1, null)) SALESMANS2
4 , count(*) COUNTS
5 from scott.emp group by job;
CLERKS SALESMANS SALESMANS2 COUNTS
4 4 1 5
Execution Plan
Plan hash value: 417468012
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 8 | 4 (25)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 8 | 4 (25)| 00:00:01 |
| 2 | HASH GROUP BY | | 1 | 8 | 4 (25)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 112 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------When mixing "double" and "single" aggregates, Oracle decides that single aggregates belong in the "outer" aggregation.
SALESMAN2 is doing a count on the aggregated job column that is the result of the "inner" group by - therefore only 1.
The count(*) also counts the result of the "inner" aggregation.
I am not sure if this is documented or if it is a "sideeffect" of either the internal code used for GROUPING SETS or the internal code used for allowing analytic functions like this:
SQL> select count(decode(job, 'CLERK', 1, null)) CLERKS
2 , count(decode(job, 'SALESMAN', 1, null)) SALESMANS
3 , sum(count(decode(job, 'CLERK', 1, null))) over () CLERKS2
4 , sum(count(decode(job, 'SALESMAN', 1, null))) over () SALESMANS2
5 from scott.emp group by job;
CLERKS SALESMANS CLERKS2 SALESMANS2
0 0 4 4
4 0 4 4
0 0 4 4
0 0 4 4
0 4 4 4
Execution Plan
Plan hash value: 4115955660
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5 | 40 | 4 (25)| 00:00:01 |
| 1 | WINDOW BUFFER | | 5 | 40 | 4 (25)| 00:00:01 |
| 2 | SORT GROUP BY | | 5 | 40 | 4 (25)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 112 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------Personally I think I would have preferred if Oracle raised an error on this "double aggregation" and thus require me to write it this way (if that is the result I desired):
select sum(CLERKS), sum(SALESMANS)
from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
from emp group by job)I can not really think of good use-cases for the "double aggregation" - but rather that it could give you unnoticed bugs in your code if you happen to do double aggregation without noticing it.
Interesting thing to know ;-) -
T1 (Table and columns & data ) used in my example
create table T1 (col1 number,col2 number);
col1 col2
1 5
2 5
3 5
4 5
11 6
12 6
13 6
14 6
CREATE OR REPLACE FUNCTION TEST (par NUMBER) RETURN VARCHAR2 IS
l_concat VARCHAR2(32767) ;
BEGIN
select wm_concat(col1) into l_concat from t1 where col2=par;
RETURN l_concat;
END;
select TEST(5) from dual;
The above example always returns a NULL as opposed to (1,2,3,4);
CREATE OR REPLACE FUNCTION TEST (par NUMBER) RETURN VARCHAR2 IS
l_concat VARCHAR2(32767) ;
l_str varchar2(32767);
BEGIN
l_str:='select wm_concat(col1) from t1 where col2=:b';
execute immediate l_str into l_concat using par;
RETURN l_concat;
END;
select TEST(5) from dual;
This returns the correct answer .i.e. (1,2,3,4);
My question is why my first code returning NULL? Is there any restriction using aggregate functions inside
plsql code ?BluShadow wrote:
The in paramter has the same name as one of the column . Thus the select query was not taking the filtering predicate as the in parameter col1 ,rather it was
using the column's value for filtering each row and hence the wm_concat was not getting any row to concatenate .That's why you should use a good coding standard and perhaps prefix parameters with "p" or "p_" and local variables with "v" or "v_" etc.Smacks too much of archaic Hungarian notation. :-)
Explicit scope definition is supported by PL/SQL. So why invent a new manual standard for scope, when there exists one already?
SQL> create or replace procedure FooProc( empNo emp.empno%Type ) is
2 empRow emp%RowType;
3 begin
4 select
5 e.* into empRow
6 from emp e
7 where e.empno = FooProc.empNo;
8
9 dbms_output.put_line(
10 'Employee '||empNo||' is '||empRow.ename||
11 ', and employed as '||empRow.job
12 );
13 end;
14 /
Procedure created.
SQL>
SQL>
SQL> exec FooProc(7369)
Employee 7369 is SMITH, and employed as CLERK
PL/SQL procedure successfully completed.
SQL> Personally, I find the v_ and p_ prefix approach quite silly - attempting to address an issue that is already solved by explicit PL/SQL scope.
Never mind that the approach of using different prefixes, attempts to identify scope - and goes down the exact same slippery scope that Hungarian notation did. Which resulted in the death of this misguided standard, many years ago.
Frustrates me to no end to see the exact SAME mistakes made in PL/SQL that were made a decade or more ago - where lessons learned since then are conveniently ignored when it comes to PL/SQL programming.
It is still seems to be the Dark Ages when it comes to PL/SQL development.... :-( -
Bug Report: ResultSet.isLast() returns false when queries return zero rows
When calling the method isLast() on a resultset that contains zero (0) rows, false is returned. If a resultset contains no rows, isLast() should return true because returning false would indicate that there are more rows to be retrieved.
Try the following Java source:
import java.io.*;
import java.sql.*;
import java.util.*;
import oracle.jdbc.driver.*;
public class Test2 {
public static void main (String [] args) throws Exception {
Connection conn = null;
String jdbcURL = "jdbc:oracle:thin:@" +
"(DESCRIPTION=(ADDRESS=(HOST=<host computer>)"+
"(PROTOCOL=tcp)(PORT=<DB port number>))"+
"(CONNECT_DATA=(SID=<Oracle DB instance>)))";
String userId = "userid";
String password = "password";
try{
// Load the Oracle JDBC Driver and register it.
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// *** The following statement creates a database connection object
// using the DriverManager.getConnection method. The first parameter is
// the database URL which is constructed based on the connection parameters
// specified in ConnectionParams.java.
// The URL syntax is as follows:
// "jdbc:oracle:<driver>:@<db connection string>"
// <driver>, can be 'thin' or 'oci8'
// <db connect string>, is a Net8 name-value, denoting the TNSNAMES entry
conn = DriverManager.getConnection(jdbcURL, userId, password);
} catch(SQLException ex){ //Trap SQL errors
// catch error
//conn = new OracleDriver().defaultConnection(); // Connect to Oracle 8i (8.1.7), use Oracle thin client.
PreparedStatement ps = conn.prepareStatement("select 'a' from dual where ? = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Use any query that will return zero rows.
ps.setInt(1, 1); // Set the params so that the query returns 0 rows.
ps.setInt(2, 2);
ResultSet rs = ps.executeQuery();
System.out.println("1. Last here? " + rs.isLast());
while (rs.next()) {
// do whatever
System.out.println("2. Last here? " + rs.isLast());
ps.close();
rs.close();
EXPECTED RESULT -
1. Last here? true
2. Last here? true
ACTUAL RESULT -
1. Last here? false
2. Last here? false
This happens to me on Oracle 9.2.0.1.0.387561,
For your information, I discovered this problem from
running a query that did access an actual DB table.
Try it and let me know.I did say I was only guessing, and yes, I did try it (after I posted my reply, and before I read yours). And I did check the query plan for the queries I tried -- to verify that they were actually doing some database "gets".
In any case, the usual way that I determine whether a "ResultSet" is empty is when the very first invocation of method "next()" returns 'false'. Is that not sufficient for you?
Good Luck,
Avi. -
Returning Multiple Rows From DBAdapter Calling PL/SQL Procedure
Oracle XE 10g Express Edition
JDeveloper 11.1.1.2.0
WebLogic Server 11g
Guys,
I have a table of orders, which I need to interrogate, and pass back any matching rows which meet certain criteria (e.g. status = 'OPEN').
However, rather than create a DBAdapter using an Operation Type of "Peform an Operation on a Table/Select", I need to use an Operation Type of "Call a Stored Procedure or Function".
I therefore need the procedure to return all the matching rows, rather than a single row.
I have looked at declaring return parameters for the procedure of the following types:
RECORD - is good because it allows me to return the elements of the row with their correct datatypes, but does not meet my needs because it will only support the return of a single row.
VARRAY - good because it can contain many row elements, but not good because it only supports a single row return, and also because all elements of the VARRAY must be of the same data type.
TABLE - good because it can contain many rows, but bad because each row can contain only two elements - the index element and the data element.
I think I could first define a RECORD (to hold a row), and then define a TABLE, with the data element being the RECORD, but I have found JDeveloper very fussy indeed when dealing with 'non-standard' data types in the DBAdapter.
Apologies if I am missing something obvious, but can anyone suggest a way of doing this?
Many thanks in advance.
Edited by: user2541290 on 17-Feb-2010 02:48Hi, I've been able to create process that seems to work. My platform is a but different but I don't think this is important for your question.
Here is the PL/SQL code. Just make Db Adapter for Calling stored procedure and it returns all rows!
Be aware of possible limitations on how manyrows you could return in one select! This can have severe impact on performance.
Succes.
Jos Baan
CREATE OR REPLACE PACKAGE lab2_multiple_rows IS
-- Author : 801455
-- Created : 18-2-2010 8:05:52
-- Purpose :
-- Public type declarations
TYPE rrows IS RECORD(
mutdat DATE,
opmerking VARCHAR2(20));
TYPE trows IS TABLE OF rrows INDEX BY BINARY_INTEGER;
-- Public constant declarations
-- Public variable declarations
-- Public function and procedure declarations
FUNCTION retrows RETURN trows;
END lab2_multiple_rows;
CREATE OR REPLACE PACKAGE BODY lab2_multiple_rows IS
-- Private type declarations
-- Private constant declarations
-- Private variable declarations
-- Function and procedure implementations
FUNCTION retrows RETURN trows IS
lrows trows;
lidx binary_integer := 1;
BEGIN
FOR rsql IN (SELECT t.* FROM jba_transactions t ORDER BY t.mutdat)
LOOP
lrows(lidx).mutdat := rsql.mutdat;
lrows(lidx).opmerking := rsql.opmerking;
lidx := lidx + 1;
END LOOP;
RETURN(lrows);
END;
BEGIN
-- Initialization
NULL;
END lab2_multiple_rows;
Edited by: Baan, Jos on 18-feb-2010 8:53 -
How just return one row of a one to many join..
So I have a one to many join where the SMOPERATOR table has data I need however it has a couple of rows that match the JOIN condition in there. I just need to return one row. I think this can be accomplished with a subquery in the join however have not been able to come up with the right syntax to do so.
So:
SELECT "NUMBER" as danumber,
NAME,
SMINCREQ.ASSIGNMENT,
SMOPERATOR.PRIMARY_ASSIGNMENT_GROUP,
SMOPERATOR.WDMANAGERNAME,
SMINCREQ.owner_manager_name,
SMINCREQ.subcategory, TO_DATE('01-'||TO_CHAR(open_time,'MM-YYYY'),'DD-MM-YYYY')MONTHSORT,
(CASE WHEN bc_request='f' THEN 'IAIO'
WHEN (bc_request='t' and substr(assignment,1,3)<>'MTS') THEN 'RARO'
WHEN (bc_request='t' and substr(assignment,1,3)='MTS') THEN 'M'
ELSE 'U' end) as type
from SMINCREQ
left outer join SMOPERATOR on SMINCREQ.assignment=SMOPERATOR.primary_assignment_group
WHERE SMINCREQ.owner_manager_name=:P170_SELECTION and SMOPERATOR.wdmanagername=:P170_SELECTION
AND open_time BETWEEN to_date(:P170_SDATEB,'DD-MON-YYYY') AND to_date(:P170_EDATEB,'DD-MON-YYYY')
AND
(bc_request='f' and subcategory='ACTIVATION' and related_record<>'t')
OR
(bc_request='f' and subcategory<>'ACTIVATION')
OR
(bc_request='t' and substr(assignment,1,3)<>'MTS')
order by OPEN_TIMeHi,
This sounds like a Top-N Query , where you pick N items (N=1 in this case) off the top of an orderded list. I think you want a separate ordered list for each assignment; the analytic ROW_NUMBER function does that easily.
Since you didn't post CREATE TABLE and INSERT statements for your sample data, I'll use tables from the scott schema to show how this is done.
Say you have a query like this:
SELECT d.dname
, e.empno, e.ename, e.job, e.sal
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
ORDER BY dname
;which produces this output:
DNAME EMPNO ENAME JOB SAL
ACCOUNTING 7934 MILLER CLERK 1300
ACCOUNTING 7839 KING PRESIDENT 5000
ACCOUNTING 7782 CLARK MANAGER 2450
RESEARCH 7876 ADAMS CLERK 1100
RESEARCH 7902 FORD ANALYST 3000
RESEARCH 7566 JONES MANAGER 2975
RESEARCH 7369 SMITH CLERK 800
RESEARCH 7788 SCOTT ANALYST 3000
SALES 7521 WARD SALESMAN 1250
SALES 7844 TURNER SALESMAN 1500
SALES 7499 ALLEN SALESMAN 1600
SALES 7900 JAMES CLERK 950
SALES 7698 BLAKE MANAGER 2850
SALES 7654 MARTIN SALESMAN 1250Now say you want to change the query so that it only returns one row per department, like this:
DNAME EMPNO ENAME JOB SAL
ACCOUNTING 7782 CLARK MANAGER 2450
RESEARCH 7876 ADAMS CLERK 1100
SALES 7499 ALLEN SALESMAN 1600where the empno, ename, job and sal columns on each row of output are all taken from the same row of scott.emp, though it doesn't really matter which row that is.
One way to do it is to use the analytic ROW_NUMBER function to assign a sequence of unique numbers (1, 2, 3, ...) to all the rows in each department. Since each sequence startw with 1, and the numbers are unique within a department, there will be exactly one row per departement that was assigned the numebr 1, and we''ll display that row.
Here's how to code that:
WITH got_r_num AS
SELECT d.dname
, e.empno, e.ename, e.job, e.sal
, ROW_NUMBER () OVER ( PARTITION BY d.dname
ORDER BY e.ename
) AS r_num
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
SELECT dname
, empno, ename, job, sal
FROM got_r_num
WHERE r_num = 1
ORDER BY dname
;Notice that he sub-query got_r_num is almost the same as the original query; only it has one additional column, r_num, in the SELECT clause, and the sub-qeury does not have an ORDER BY clause. (Sub-queries almost never have an ORDER BY clause.)
The ROW_NUMBER function must have an ORDER BY clause. In this example, I used "ORDER BY ename", meaning that, within each department, the row with the first ename (in sort order) will get r_num=1. You can use any column, or expression, or expressions in the ORDER BY clause. You muight as well use something consistent and predictable, like ename, but if you really wanted arbitrary numbering you could use a constant in the analytic ORDER BY clause, e.g. "ORDER BY NULL". -
Resultset returns null while calling a DB2 stored procedure using hibernat
Hi All ,
I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line
Java code....................
CallableStatement stmt3 = EyeHibernateApp.getHibernateSession().connection().prepareCall("{call answers_select_id( ? )}");
stmt3.setString(1,20);
stmt3.execute();
ResultSet rs1 = stmt3.getResultSet();
System.out.println("rs1 " + rs1); --> returns null
procedure-------------
CREATE PROCEDURE answers_select_id (IN question_id bigint )
P1:BEGIN
DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
SELECT a.answer_id from answers as a where a.question_id = question_id;
open cursor1;
END P1;
I am using the same java code with mysql stored procs . It works fine there but I assume open cursors in db2 stored proc is causing the problem . If I can help it , I need to maintain the same java code for mysql ad db2 . Please help me ...
Thanks,
Av~Hi,
I am trying to do something like this but with Oracle stored procedure which returns an associate array and a cursor and these are defined as INOUT. I am not finding a way how to do it with editable row set. Can you plese list the steps used to make things work.
Thanks. -
Resultset returns null while calling a DB2 stored procedure using hibernate
Hi All ,
I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line
Java code....................
CallableStatement stmt3 = EyeHibernateApp.getHibernateSession().connection().prepareCall("{call answers_select_id( ? )}");
stmt3.setString(1,20);
stmt3.execute();
ResultSet rs1 = stmt3.getResultSet();
System.out.println("rs1 " + rs1); --> returns null
procedure-------------
CREATE PROCEDURE answers_select_id (IN question_id bigint )
P1:BEGIN
DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
SELECT a.answer_id from answers as a where a.question_id = question_id;
open cursor1;
END P1;
I am using the same java code with mysql stored procs . It works fine there but I assume open cursors in db2 stored proc is causing the problem . If I can help it , I need to maintain the same java code for mysql ad db2 . Please help me ...
Thanks,
Av~Hi,
I am trying to do something like this but with Oracle stored procedure which returns an associate array and a cursor and these are defined as INOUT. I am not finding a way how to do it with editable row set. Can you plese list the steps used to make things work.
Thanks. -
DECODE is not working in WHERE clause when subquery returns more rows
Hi Gurus,
I want to write a query on CCENTERS table(Script given below) and expect the following result:
1. When I pass a value of 0 for ID, It returns all the rows given in the table.
2. When I pass a value other than 0, It returns the row for the given value as well as all its child records.
CCENTER has parent-child relationship in ID and BASE column. I am using a query with DECODE function. but DECODE function in WHERE clause is not capable of handling sub-query with multiple rows.
VARIABLE ParaCCenter NUMBER
BEGIN
:paraccenter:=0;
END;
CREATE TABLE ccenters
(id NUMBER,
name VARCHAR2(20),
base number);
INSERT INTO ccenters VALUES(1,'NUST',null);
INSERT INTO ccenters VALUES(2,'SEECS',1);
INSERT INTO ccenters VALUES(3,'NBS',1);
commit;
SELECT * FROM ccenters
WHERE id IN DECODE(:ParaCCenter, 0, id,
(SELECT id FROM ccenters
START WITH base=:ParaCCenter
CONNECT BY PRIOR id = base
UNION
SELECT :ParaCCenter FROM dual
BEGIN
:paraCCenter:=1;
END;
SELECT * FROM ccenters
WHERE id IN DECODE(:ParaCCenter, 0, id,
(SELECT id FROM ccenters
START WITH base=:ParaCCenter
CONNECT BY PRIOR id = base
UNION
SELECT :ParaCCenter FROM dual))
The result is
(SELECT id FROM ccenters
ERROR at line 3:
ORA-01427: single-row subquery returns more than one row
How this query can be rewritten for the given functionality. Any response will be highly appreciated.
ThanksAnd if you want to use DECODE:
SQL> BEGIN
2 :paraccenter:=0;
3 END;
4 /
PL/SQL procedure successfully completed.
SQL> select *
2 from ccenters
3 where :paraccenter = decode(:paraccenter,0,0,id)
4 /
ID NAME BASE
1 NUST
2 SEECS 1
3 NBS 1
SQL> BEGIN
2 :paraccenter:=2;
3 END;
4 /
PL/SQL procedure successfully completed.
SQL> select *
2 from ccenters
3 where :paraccenter = decode(:paraccenter,0,0,id)
4 /
ID NAME BASE
2 SEECS 1
SQL> SY. -
SQL Query (PL/SQL Function Body returning SQL query) doesn't return any row
I have a region with the following type:
SQL Query (PL/SQL Function Body returning SQL query).
In a search screen the users can enter different numbers, separated by an ENTER.
I want to check these numbers by replacing the ENTER, which is CHR(13) || CHR(10) I believe, with commas. And then I can use it like this: POD IN (<<text>>).
It's something like this:
If (:P30_POD Is Not Null) Then
v_where := v_where || v_condition || 'POD IN (''''''''||REPLACE(''' || :P30_POD || ''', CHR(13) || CHR(10), '','')||'''''''''')';
v_condition := ' AND ';
End If;
But the query doesn't return any rows.
I tried to reproduce it in Toad:
select * from asx_worklistitem
where
POD IN (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
==> This is the query that does't return any rows
select (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
from dual;
==> This returns '541449200000171813','541449206006341366'
select * from asx_worklistitem
where pod in ('541449200000171813','541449206006341366');
==> and when I copy/paste this in the above query, it does return my rows.
So why does my first query doesn't work?
Doe anyone have any idea?
Kind regards,
Geert
Message was edited by:
ZorryThanks for the help.
I made it work, but via the following code:
If (:P30_POD Is Not Null) Then
v_pods := REPLACE(:P30_POD, CHR(13) || CHR(10));
v_where := v_where || v_condition || 'POD IN (';
v_counter := 1;
WHILE (v_counter < LENGTH(v_pods)) LOOP
v_pod := SUBSTR(v_pods, v_counter, 18);
IF (v_counter <> 1) THEN
v_where := v_where || ',';
END IF;
v_where := v_where || '''' || v_pod || '''';
v_counter := v_counter + 18;
END LOOP;
v_where := v_where || ')';
v_condition := ' AND ';
End If;But now I want to make an update of all the records that correspond to this search criteria. I can give in a status via a dropdownlist and that I want to update all the records that correspond to one of these POD's with that status.
For a region you can build an SQL query via PL/SQL, but for a process you only have a PL/SQL block. Is the only way to update all these records by making a loop and make an update for every POD that is specified.
Because I think this will have a lot of overhead.
I would like to make something like a multi row update in an updateable report, but I want to specify the status from somewhere else. Is this possible? -
How to check the sql:query is return null value
I have use :
<sql:query var="sql1" dataSource="${db}">
select col_name from table_name
where a=<c:out value="${row.test1}"/>
and b='<c:out value="${row.test2}"/>'
</sql:query>
So, how can I check this statement return null value which is no record within this table?The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
<sql:query var="books"
sql="select * from PUBLIC.books where id = ?" >
<sql:param value="${bookId}" />
</sql:query>
<c:if test="${books.rowCount > 0}">
</c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
Look for query Tag Result Interface
Maybe you are looking for
-
Re: Satellite P300-161 - Random Lock-ups/Freezing
Hi all, I've had my Toshiba Satellite P300-161 laptop for roughly about 6 months now. However, during the past month or so.. I've been experiencing random freezing of the whole laptop. It usually just starts off at anytime.. then it'll have a break t
-
Sending BP from CRM to R/3
HI , I have a Business Partner which got struck in CRM. I need to send it to R/3. I tried CRMM_BUPA_SEND to send it across but it didnt.It gave out error in SMW01 transaction "No batch input data for screen SAPMF02D 0900" I noticed that the BPs canno
-
Where can I find a users manual for Galaxy S5
I just bought my S5 yesterday and there are several things I need to do and cannot find any way to do them. Plus there are several things transferred from my old phone that need correcting and I am unable to do that, too.
-
Default Expense Type in Travel Expense
Dear All I have a requirement. I have created 4 Expense Types AIR HOTEL TAXI TRAIN. Now my requirement is everytime employee tries to create an Expense Report in correspondence to the Travel Request, the expense type HOTEL gets defaulted in the lower
-
Can't install Photoshop Elements 11 licensed version because of trial version
I can't install Photoshop Elements 11 licensed version because of trial version that is still on my computer and is not being completely uninstalled. The intended folder to install has some files remaining from the trial version, and this prevents t