Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Oracle query aggregation with date manipulations

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Oracle query aggregation with date manipulations
 Login/Join
 
Platinum Member
posted
Hello Everyone

We have a table with an Oracle field called SOMEDATE which is HYYMDS.

We report against this table and often show the output grouped by Month Name (Jan-Dec). In order to do this we define a field like this...

DEFINE FILE XXX
MONTH_COMPONENT/A3 = HNAME(SOMEDATE, 'MONTH', 'A3');
END
TABLE FILE XXX
SUM SOMEFIELD
BY MONTH_COMPONENT
END

When we look at the generated SQL that is sent to Oracle, the data is not aggregated, and is sent back without the grouping by month. So all of the data is returned and then WebFocus does another pass at the data and groups it by month.

Of course in Oracle, grouping the data by month straight away is very easy to accomplish by using TO_CHAR(SOMEDATE, 'MON').

The question is this: is there a way to return the data from Oracle with the data already grouped by month. We are in fact talking about potentially millions of rows that are being returned from Oracle when we could have Oracle return the data already grouped by month.

Is there a way to accomplish this without using SQL Passthru?

On a related note, using this...

WHERE MONTH_COMPONENT EQ 'JAN' is very slow. When in Oracle TO_CHAR(SOMEDATE, 'MON') = '1' is very fast.

Thanks

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Guru
posted Hide Post
jodye,
You're probably scanning the whole table. Remember that Oracle doesn't know what defines are. Try moving it to a WHERE clause that Oracle can understand and get rid of the define.
Good Luck,
Carol



WebFOCUS 7.6.6/TomCat/Win2k3
 
Posts: 428 | Location: Springfield, MA | Registered: May 07, 2003Report This Post
Platinum Member
posted Hide Post
Hi Carol

Actually I simplified the code for the purposes of my post. In fact the query is extremely efficient and has about 8 wheres in it. We are using an Oracle index. We always limit it to dates between X and Y. But we still want to group by month and we want it returned from Oracle ALREADY grouped by month.

Thanks.


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Guru
posted Hide Post
Hi Jodye,
I would put it in a Focus HOLD file and then do the group by. Just wondering why you need to do it in Oracle?



WebFOCUS 7.6.6/TomCat/Win2k3
 
Posts: 428 | Location: Springfield, MA | Registered: May 07, 2003Report This Post
Platinum Member
posted Hide Post
Hi Carol

We want to do it in Oracle because WebFocus is downloading hundreds of thousands of records for nothing.

I am thinking that doing it in a hold file will serve no purpose. In both cases, Webfocus is doing the following: Pass1=download all records. Pass2=group by month. If I explicitly state to use a hold file, it doesn't change the fact that the first pass is still downloading records for nothing. They should ALREADY be grouped by Oracle via the TO_CHAR function. Unless I am missing something here?

Thanks for helping me wrap my head around this Carol.


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Oracle query aggregation with date manipulations

Copyright © 1996-2020 Information Builders