How to do a union with a report query
I've looked all over but can't seem to find any documentation that would suggest how to generate a union for a report query.
The "all java" method would be two disparate report queries and then co-mingle the results. But wed really like to have Oracle do the union and process only one result set.
We are trying desperately to avoid the code the SQL yourself solution.
Why a union? The Toplink expression generates SQL that takes Oracle over a minute to resolve. The Oracle Plan/Optimizer has several joins and full table scans in it that burn up the clock. If we break the expression apart at a very important or clause each of the individual expressions takes a second or so no full table scans. If we manually bolt the two expressions back together with a union the home grown expression takes a couple of seconds as the Oracle Optimizer executes each select and then combines the results.
So any suggestions about how to get a Toplink union would be appreciated.
I'm not much of a DBA or SQL guru, but here are a couple thoughts:
- Is it possible to use a hint in association with the query to help Oracle with the join? Specifying hints is a new feature in 904 and may be your best solution here.
- I don't think there is any union facility in the expression framework, but you might want to take a look at making an ExpressionOperator to do this. I think if you search this forum for ExpressionOperator you would hit some ideas.
- Would it be reasonable or feasable to break the queries in two and then do the union in the middle tier? Just thinking out loud...
- Don
Similar Messages
-
How GET Output to Excel with Oracle9i Report using OC4J
how GET Output to Excel with Oracle9i Report using OC4J.
I FINISHED THE SETPS CONCIDERING THE JSP CODE NEEDED TO GET THE EXCEL OUTPUT ON LOCAL MACHINE.
I NEED TO PUBLISH THIS REPORT THROUGH APPLICATION SERVER.
THE QUESTION IS:
1- HOW TO START AN OC4J INSTANCE FROM ORACLE 9I DS FOR THIS REPORT?
2- WHERE (PATH) TO PUBLISH THE REPORT ON THE APPLICATION SERVER?
3- WHAT IS THE DEFAULT URL TO RUN THIS REPORT AND WHERE TO PUT IT?
4- HOW TO MAKE MAPPING FOR DIRECOTRY PATH TO TRANSLATED AS URL FOR THIS REPORT?
5- IF ANY ONE CAN GIVE ME THE FULL CODE TO RUN AND CALL SIMPLE JSP REPORT TO BE VIED IN INTERNET EXPLORER.
THANK YOUHi,
I can't answer to all your questions, however I can tell you that:
2) The directory where to put the report file is specifiend in a file named
<serverName>.conf
in the sourceDire property
<property name="sourceDir" value="/directory/dove/mettere/i/report"/>
that you can find under ORACLE_HOME/reports/conf
3) The URL is
http://<server IAS address>:<port number>/<jsp file path>/<repName>.jsp?server=<report server name>&userid=<user>/<pwd>@<DB conn string>[&<param>=<valore>[&...]]
5) In IE you have only to set the previous URL in the address bar.
Hope this helps you
Bye
Raffy -
How can i register column with in the query
hi all
how can i register column with in the query?Thanks.
In my business one, the column width was registed.
But I don't know how can I do it.
So I try to save the query again after change column width.
Then the query was opend with changed column width.
Is it right function?
Is there any way to register the column width?
It's very troublesome to change column width every time.
seiichi -
How to start universe development with excel reports?
hi,
I have about 6 reports in excel with the help of which i have to create universe. Please help how to start and how i can make the universe? Examples will help much better.
How to study the reports and start with development?Hi Vaibhav,
Kindly check the below thread.
How to create a Universe with excel?
Regards,
Tanb Gupta -
How to lock a user with a report in batch?
Hi experts,
is it possible to lock a range of users with a report which runs in batch? I decide to modify the report EWULKUSR, because I can't run this report in batch. But maybe there is any other report?
Any idea?
Thanks and best regards
MaxHi Sim,
I mean, locking the user in the system.
Thanks for your answer.
Best regards,
Max -
How do I reference columns in a report query from another report query?
In Apex 3.1 it is possible to generate a report on more than one query. I have read that these queries can be correlated, but I cannot find how in the documentation.
I go the Shared Components and create a new Report Query:
select * from dept
Then I click Add Query and I add:
select * from emp
How do I correlate these two queries (I want to join emp.deptno to dept.deptno) and have a nice hierarchicle XML-file.
Is it possible in Apex 3.1?
Dik DralDik,
This type of query can't be build. The two queries are independent, you can't reference values in the first query from the second query. However you can reference page and application items - which won't help you all that much with this scenario though. You could also try combining the two queries into one, and then take care of the proper presentation in your template.
Regards,
Marc -
How to use format-date with the report parameter
Hi all,
How to use the format-date function with this tag,
<?param@begin:P_FROM_DATE?><?$P_FROM_DATE?>
this form date is coming from report parameter and is coming like this 2012/11/01 00:00:00.
So now i need this in DD-MON-YYYY fromat.I tried like this <?param@begin:P_FROM_DATE?><?$format-date:P_FROM_DATE;'DD-MON-YYYY'?>
but its giving error. Can any one pls tell how to convert it to customized date format.
thanks & Regards
Srikkanth.MIssue solved.
Ref this link
XML date Format -
How to create dynamic variables with SSRS report ?
Hi everyone,
I want to create one dynamic SSRS report which can show details when user input data into textbox . Example : Users will input app_id then report will show details of each this id ( name, phone,salary...) .
Pls help me solve it .
Many thanks,
HongFollow below step.
1. First create a dataset. The select statement or result set must contain (App_id, name, phone,salary...).
2. Add a report parameter "App ID" with default setting.
3. Drag dataset fields to a table or tablix. Select the tablix properties. Go to Filter section.
4. Select the expression as Field App ID, Operator as "=" and Value as Parameter App ID.
Regards, RSingh -
How to export subreports along with main reports in crystal reports 2008
Hi
I am having serious issues in Crystal Reports 2008. While I was trying to export one of my reports(having 3 subreports) in to a pdf file,well only the main report data is getting exported.
My subreports are ON DEMAND SUBREPORTS.
Kindly help me in resolving this issue.
Thanks in advance
Sam_dwhThanks Debi for your answer.
Well now I am thinking of publishing the reports which I have generated ,so that client need not have to install crystal reports individually in their computers.But I don't have BO portal as such for publishing.
What will I do? -
How can we avoid union all in this query.....
Dear All,
I have a query which has union all.I want a query with the same result without using union all.Can anyone help me?Here is my query.............
SELECT DID,
DM.DISTRICT_DESCRIPTION "DISTRICT_NAME",
MID,
DM.DISTRICT_DESCRIPTION || '(D)' "MANDAL_NAME",
200706,
'SD_OB' "EXP_CAT",
SUM(NVL(AMOUNT,0))-SUM(NVL(AMOUNT1,0)) "AMOUNT" FROM
(SELECT SUBSTR(AC.PCC_INFO_CODE,3,2) "DID", SUBSTR(AC.TRANSACTION_ID,6,2) "MID",NVL(SUM(AMOUNT),0) "AMOUNT", 0 "AMOUNT1"
FROM ACCTD_CLAIMS AC
WHERE TO_CHAR(AC.CLAIM_DATE,'YYYYMM') <= PREV_MONTH(200706)
AND AC.HOA_ID='18 '
AND SUBSTR(AC.TRANSACTION_ID,1,3) <> 'CRR'
GROUP BY SUBSTR(AC.PCC_INFO_CODE,3,2),SUBSTR(AC.TRANSACTION_ID,6,2)
union all
SELECT SUBSTR(AC.PCC_INFO_CODE,3,2) "DID", SUBSTR(AC.TRANSACTION_ID,6,2) "MID",0 "AMOUNT" , NVL(SUM(AMOUNT),0) "AMOUNT1"
FROM ACCTD_CLAIMS AC
WHERE
TO_CHAR(AC.PAY_DATE,'YYYYMM') <= PREV_MONTH(200706)
AND AC.HOA_ID='18'
GROUP BY SUBSTR(AC.PCC_INFO_CODE,3,2), SUBSTR(AC.TRANSACTION_ID,6,2)), DISTRICT_MASTER DM
WHERE DM.DISTRICT_ID=DID
GROUP BY DID, MID, DM.DISTRICT_DESCRIPTION;
Regards,
Krishnadeep.<I want a query with the same result without using union all>
You can write a pipelined function, which will be about ten times the work. Its best to use the simples tools; why don't you want to use UNION ALL since its probably the best answer? -
How to insert multiple records with a single query?
Hi,
I've to save a huge number of installments with their other information such as due on blah blah. Now, I want to add the all of these information at once with a single insert query.
How can I do that?Hi
What is your source data?
If the source is external to the SQL Server (like a log file, Excel, CSV, JSON, XML, external application...) you can and should insert it all using Bulk Insert operation.
Pls clarify what is your source data, and if you need more help using Bulk Insert.
https://www.simple-talk.com/sql/learn-sql-server/bulk-inserts-via-tsql-in-sql-server/
http://msdn.microsoft.com/en-us/library/ms188365.aspx
[Personal Site] [Blog] [Facebook] -
How to restrict the data with Filter in Query - Updated the description
Hi all,
Free Characteristics: u2018Service Orderu2019 & u2018Statusu2019.
Key Figures: u2018Response Timeu2019 & u2018Data Record Counteru2019.
Calculated Key Figure: u2018Resp Time > 1 hru2019.
Only u2018Plantu2019 is in ROWS and u2018Resp Time > 1 hru2019 & u2018Data Record Counteru2019 are in COLUMNS section.
The report looks like the below:
Plant---Resp Time > 1 hr -
Data Record Counter
100--1--
2
101--1--
3
After dragging the u2018Service Ordersu2019 from u2018Free Characteristicsu2019 , the report looks like the below:
Plant---Service Order -
Resp Time > 1 hr ---Data Record Counter
100--111--
1
100--120--
1
101--130--
1
101--141--
1
101--150--
1
I want only records whose u2018STATUSu2019 is u2018Yu2019. The u2018STATUSu2019 is u2018Blanku2019 for Service Orders 12, 13 & 15
and those records should not be there in the report.
The report should be like the below:
After dragging the u2018Service Ordersu2019 from u2018Free Characteristicsu2019, the report looks like the below:
Plant---Service Order -
Resp Time > 1 hr ---Data Record Counter
100--111--
1
101--141--
1
After creating the Restricted KF u2018Countu2019 on u2018Data Record Counteru2019 by restricting u2018STATUSu2019 to u2018Yu2019 and
dragging the u2018Service Ordersu2019 from u2018Free Characteristicsu2019, the Count shows ZERO :
Plant---Service Order -
Resp Time > 1 hr ---Count
100--111--
0
100--120--
0
101--130--
0
101--141--
0
101--150--
0
If I keep the Filter (globally) on 'STATUS = Y' then it returns 'NO Data'.
If I keep the u2018Service Ordersu2019 is in u2018Rowsu2019 and the Filter on u2018STATUSu2019 (u2018Yu2019) then it works fine, but the report should be based on PLANT.
Thanks in advance.
Reagrds,
Venkat.Hi Gurus,
Thanks for u r all prompt replies...
Got the Solution...
Actually no need to work at query level...
iN Multiprovider.... we can select the WBS element Char for which ever cube data we want... just drop down the char in to the dimension which we need and R/click the Char select identification of participating char.. un-select the check box for char WBS element for the Cubes which we dont require the data......
Thanks to all
Cheers
Lajwanth
Edited by: Lajwanth Singh on Apr 27, 2010 10:41 PM -
How to use Field-symbol with dynamic select query
Can anybody tell me, how to use field-symbols in the dynamic select query.
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
eg.
FIELD-SYMBOLS <fs> TYPE ANY.
DATA: BEGIN OF line,
string1(10) VALUE '0123456789',
string2(10) VALUE 'abcdefghij',
END OF line.
WRITE / line-string1+5.
ASSIGN line-string1+5(*) TO <fs>.
WRITE / <fs>.
output:
56789
56789
reward if helpful
anju -
Error with Interactive Report Query
Hi,
using apex 4.1 on 11.2.0.1
i have the following query in an IR:
select *
from v_dialer_egn
where dtstart between :P200_STARTDATE and :P200_ENDDATEwhen i submit the query,the following error returns:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [FreeTDS][SQL Server]Operand type clash: text is incompatible with datetime[FreeTDS][SQL Server]Statement(s) could not be prepared. ORA-02063: preceding 2 lines from DIVOSECCv_dialer_egn is defined as:
CREATE OR REPLACE FORCE VIEW V_DIALER_EGN
DTSTART,
AGENTNUMBER,
AGENTNAME,
STRCALLEDNUMBER,
CAMPAIGNNAME,
CALLSTATUS,
NDURATIONSEC,
NSPEAKDURSEC,
NEXTRAWORKDURATIONSEC,
CALLTRIES
AS
SELECT "dtstart" AS dtstart,
"agentnumber" AS agentnumber,
"agentname" AS agentname,
"strcallednumber" AS strcallednumber,
"campaignname" AS campaignname,
"callstatus" AS callstatus,
"ndurationsec" AS ndurationsec,
"nspeakdursec" AS nspeakdursec,
"nextraworkdurationsec" AS nextraworkdurationsec,
"calltries" AS calltries
FROM v_ora_dialer_egn@divosecc;the query works on sqlplus/toad/sqldeveloper
desc v_dialer_egn shows that dtstart is a date column.
if i remove the where clause, the query is accepted by apex.
v_ora_dialer_egn@divosecc is a view on mssql (v 10.x)
connected using freetds and unixodbc
Edited by: unficyp on 17.02.2012 06:31I think you , using a Sql Server Database, have to convert the two text fields (:P200_STARTDATE , :P200_ENDDATE).
Check this conversions and let me know if it works:
http://www.sqlusa.com/bestpractices/datetimeconversion/
edit: Something like:
SELECT *
FROM V_DIALER_EGN
WHERE DTSTART BETWEEN CONVERT(DATETIME,:P200_STARTDATE, 103) AND CONVERT(DATETIME,:P200_ENDDATE, 103)Edited by: Vitor Rodrigues on 17/Fev/2012 14:37 -
Hi all,
I got reports error out when using IPP printer. It bursts out REP-177 and REP-713 errors in fact. Could anybody advice how-to use IPP printer with Oracle Report ?user9066239 wrote:
Hi all,
I got reports error out when using IPP printer. It bursts out REP-177 and REP-713 errors in fact. Could anybody advice how-to use IPP printer with Oracle Report ?Same Answer. 10g not supported.
It's introduced in 11g.
Maybe you are looking for
-
I just bought a new iPhone and added 25$ to my iTunes and it won't let me buy anything bc it says I have to type in my security questions answers but I don't rennet them what do I do? Please help me I don't want my 25$ to go to waste
-
Addition of a inputfield as column to item level table in shopping cart
Dear Experts i added a new inputfield to item level table as columen of Shopping cart and binded a variable from context. that column is displayed in the table but it is displayed in Disabled mode im not able to give input to the column(as it is a in
-
Error while opening perspective after project creation
Hi, I am getting following error in opening perspectives after creating project. I am not able to see project in any perspective (not even in 'Navigator'). Following is the exception stack trace in error view --> com.tssap.j2ee.model.J2eeCreateExcept
-
Can't get printer utility to launch
My HP DeskJet 6840 is haing printing issues, seems as though the heads are not aligned. Problem is I can't get the utility to open up. Went into printer set-up utility and selsected the printer from the list. But the utility button is grayed out. Can
-
Hi All, I need help on a subquery to return multiple rows. I included this subquery in the select statement. Can someone help on the query select a.total from TableA a where a.ID = b.ID and a.type = 'R' or a.total = 0 Thanks Vani