Using union operator in discoverer
Hi All,
I have a sql statement which is to be implemented in discoverer:
(select ........where user_entered_date='YYYY/MM/DD' )
UNION
(select ........where user_entered_date='YYYY/MM/DD'
AND (select ........where user_entered_date='YYYY/MM/DD' ))
Problem:
a) There are nested select statements which require parameters to be entered by the user.
b) How would I implement the union operator in the above scenario?
I would really appreciate it if someone could give a work around.
Regards,
Nav
Hi,
Unfortunately, we can not have a SQL query with Union in Discoverer directly.
You should create a view based on the complete query and then create folder using the view.
You can provide a parameter at the report level.
For eg :
View query : select as_of_date from table_name
Report : Add a paremeter for as_of_date
Hope this Helps!
Yogini
Similar Messages
-
Writing query using UNION Operator
Question -
(1)
Write an SQL Statement to list the following items: Customer ID, Customer Name, number of invoices, sum of total for invoices. Ensure that all customers are returned in the result set.
Answer for the above is written as below by one person. That seams to be correct. Is there another way of writing this same query.;
select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
from gee_customer c,(select customer_id,count(*) as cnt, sum(TOTAL) as s
from gee_invoice
group by customer_id) i
where c.CUSTOMER_ID = i.customer_id (+)
(2)
My other question is How to write the above answer (or what you sugest) using UNION operator ?
Any ideas please
Message was edited by:
user483578In fact the outer join means you use the union of two result sets - usual join result
and the rows from the outer table for which there is not any row in the inner table.
SQL> select d.deptno, e.ename from emp e, dept d
2 where d.deptno = e.deptno(+)
3 order by 1,2
4 /
DEPTNO ENAME
10 CLARK
10 KING
10 MILLER
20 ADAMS
20 FORD
20 JONES
20 SCOTT
20 SMITH
30 ALLEN
30 BLAKE
30 JAMES
30 MARTIN
30 TURNER
30 WARD
40
15 rows selected.
SQL> select d.deptno,e.ename from emp e, dept d
2 where d.deptno = e.deptno
3 union
4 select deptno, null
5 from dept d where not exists (select null from emp e where e.deptno = d.deptno)
6 order by 1,2
7 /
DEPTNO ENAME
10 CLARK
10 KING
10 MILLER
20 ADAMS
20 FORD
20 JONES
20 SCOTT
20 SMITH
30 ALLEN
30 BLAKE
30 JAMES
30 MARTIN
30 TURNER
30 WARD
40
15 rows selected.In your example something like (NOT tested !)
with i as (select customer_id,count(*) as cnt, sum(TOTAL) as s
from gee_invoice group by customer_id)
select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
from gee_customer c, i
where c.CUSTOMER_ID = i.customer_id
union
select c.CUSTOMER_ID,c.NAME,null,null
from gee_customer c
where not exists (select null from i where c.CUSTOMER_ID = i.customer_id)
Rgds. -
Creating table or View using UNION Operator ???????
Hi all
please need some help ,i have created aquery using UNION operator
(i.e
select A,to_number(null),C from table1
Union
select A,B,To_number(null) from table2)
it gives the output correctly and i need to make this output as View ot table
eacg time i use
Create or replace view v_1 ...........
it gives me this error :: unknown command "UNION" - rest of line ignored.
can any one pls tell me what to do
ThanksHi,
I found there is no error in your sql
create view x_v
as
select a from x
union
select to_number(null) from y;
this works fine.
in your sql check your right or left peranthesis
regards
Ripudaman -
Prioritizing a set by using union operator
My requirement is to print data whose log_in_id starts with a and end with y first, then to print data starting with a and b.
select * from userid where log_in_id like 'a%y' union select * from userid where log_in_id like 'a%' or log_in_id like 'b%'Why go through the table twice? I would do something like:
SQL> SELECT log_in_id
2 FROM (SELECT 'bob' log_in_id FROM dual
3 UNION ALL
4 SELECT 'bill' from dual
5 UNION ALL
6 SELECT 'ally' from dual
7 UNION ALL
8 SELECT 'abby' from dual
9 UNION ALL
10 SELECT 'allen' from dual
11 UNION ALL
12 SELECT 'albert' from dual)
13 ORDER BY CASE WHEN log_in_id LIKE 'a%y' THEN 1 ELSE 2 END,
14 log_in_id;
LOG_IN
abby
ally
albert
allen
bill
bobHTH
John -
UNION operator in ejb 3.0
Hi All,
I have to use UNION operator in my ejb ql. My underlying database is MySQL.
My ejb ql is
SELECT s from eee s where s.name like 'XXX'
UNION
SELECT t from eee t where t.default_id = 'XXX'
union is on the same entitybean.
In my eee entity bean I have tried
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
Ejb ql doesnot return the expected results.
Could someone please help me out with UNION operator in ejb 3.0
Thanksyou should have little problems, but just how little is container specific. I successfully run JEE 1.4 stuff on JBoss 5.1 for example without having to make any configuration changes. Heck, I mix that technology with EJB 3 tech, even having shared container managed transactions.
BTW: you mean JEE5, not J2SE 1.5. Big difference in what they represent. -
All,
I have a requirement in SQL that I have to number each row. Hence I thought of using ROWNUM. But the sql query I'm using uses UNION operator. Hence I used like this
select a,b,rownum as 'field1' from table1
union
select c,d,1 as 'field1' from table2
Will the above query solve my purpose?
thanks
senjeneesh wrote:
This will probably kill the purpose of UNION - which is to take only the DISTINCT rows..
If DISTINCT is not intended, it is better to choose UNION ALLYes, you are correct about use of UNION. Probably, OP would have wanted to use Union ALL perhaps, but might have forgotten about suppressing of duplicates and sorting and ended up using Union.
But, in accordance with the original query used by OP, my suggestion of row number would not affect the output, I guess, would it?
Perhaps, if OP would have provided us with some base sample data and the Output desired from it, it would have been of greater help. -
With using the Union oper. query
Hi Team
I have table like A and B
A table Structure
C1-------C2-------C3
R1-------R2--------R3
R4-------R5---------R6
B table Structure
C1-----C2
R11----R8
my output is like below
C1-------C2-------C3
R1-------R2--------R3
R4-------R5---------R6
R11----R8----------null
i can use the Union all condition i don't want to use the
union all condition who? plz help
select c1,c2,c3
union
select c1,c2;870003 wrote:
Hi Team
I have table like A and B
A table Structure
C1-------C2-------C3
R1-------R2--------R3
R4-------R5---------R6
B table Structure
C1-----C2
R11----R8
my output is like below
C1-------C2-------C3
R1-------R2--------R3
R4-------R5---------R6
R11----R8----------null
i can use the Union all condition i don't want to use the
union all condition who? plz helpWhy don't you want to use union all, because that is exactly what you are trying to achieve? -
ORA-22950 when selecting geometry and using union
Any query where results are UNIONed where an sdo_geometry is in the selection list (such as the one below) gives me "ORA-22950 cannot ORDER objects without MAP or ORDER method".
select p.point_id id, p.geom from point p
union
select l.line_id id, l.geom from line l
Perhaps it's possible to define a map or order method for sdo_geometry (or perhaps not), but I don't want to order by geometry.
I'm running this within SQL Plus (either 8.1.5.0.0 or 8.1.6.0.0 will do it)
and am connecting to
"Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production"
I tried adding an order by clause to order by id, to no effect.
Any ideas?Hi Ben,
The use of the union operator tells Oracle only to return a unique set of rows, hence a sort is done (in this case attempted, since there is no geometry sorting routine).
If you choose union all, then no sort will be attempted.
Hope this helps,
dan -
Xpath union operator (|)
I am having trouble using the xpath union operator (|).
The selectNodes method of the oracle.xml.parser.v2.XMLNode is throwing an exception when I use any xPath expression with a pipe such as the one below. Does the Oracle Parser support this type of xPath operator?
Thanks,
Michael
//test/me[@id=3|@id=5]
<test>
<me id="5">you</me>
<me id="3">be</me>
</test>I discovered that this XPath returns the expected result:
//test/me[@id=3]|//test/me[@id=5] -
Hi everyone
I need to merge the data from two omogenous tables (be aware: two tables not two data services; the tables are populated by the user). I specifically need to do this client-side.
When I try to connect the out port of a table to the union operator, the input ports of the operator are grayed out.
I assume the union operator can be used only to merge data from data services: has anyone faced this issue before?
Thanks
Points will be awarded
VTHi Vincenzo,
this is where you reach some limitations in the Visual Composer.
The union operator is made to work on data services, not on tables.
The only ways to solve this are either to use another tool (WebDynpro) or to make use of a data service that would perform the necessary operation for you (creating a specific RFC or Web Service).
Rgds,
Karim -
Error while using between operator with sql stmts in obiee 11g analytics
Hi All,
when I try to use between operator with two select queries in OBIEE 11g analytics, I'm getting the below error:
Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Location: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool.socketrpcserver, saw.threads
Odbc driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27002] Near <select>: Syntax error [nQSError: 26012] . (HY000)
can anyone help me out in resolving this issue.Hi All,
Thank u all for ur replies, but I dint the exact solution for what I'm searching for.
If I use the condition as
"WHERE "Workforce Budget"."Used Budget Amount" BETWEEN MAX("Workforce Budget"."Total Eligible Salaries") AND MAX("Workforce Budget"."Published Worksheet Budget Amount"",
all the data will be grouped with the two columns which I'm considering in the condition.
my actual requirement with this query is to get the required date from a table to generate the report either as daily or weekly or monthly report. If I use repository variables, variables are not getting refreshed until I regenerate the server(which I should not do in my project). Hence I have created a table to hold weekly start and end dates and monthly start and end dates to pass the value to the actual report using between operator.
please could anyone help me on this, my release date is fast approaching. -
Adding new column in an existing report which was build using Union
While working in OBIEE 11g I encounter an issue.
My existing report was build using UNION at Criteria Tab in Analysis. Now I have a requirement to add a new column into the same report. For each criteria I have added the new column but when I go back to the "Result Columns". I see a new field added but it is not allowing me to open or edit column properties for that new column & at the same time it is not allowing me to navigate to other tabs like Results, Promts, and Advanced.
I don’t want to build this report from scratch. Is there any workaround to get it resolved?Hi,
Just check it once the new added column data types are mismatched or not?
and the new added column should be navigated into excluded section, so u should edit the report and dragged into the table column section.
Thanks.. -
How to get the values in a single row without using union
Hi,
I have a table with the following structure and data
empid address phoneno emailid
1001 xyz
1001 1234234
1001 [email protected]
1002 23434
1002 [email protected]
1003 abcd
1003 [email protected]
1004 [email protected]
I need to have a result in this format.
emp id address phoneno emailid
1001 xyz 1234234 [email protected]
1002 23434 [email protected]
1003 abcd [email protected]
1004 [email protected]
I can do it using union however that gives a performance issues with a large table. So I wish to do using in any other way using lead or something, but with the complexity about the data, I couldn't do it.
Can anyone please help me?
Natarajan
Edited by: Nattu on Dec 3, 2009 3:50 PMSelect employee_id, max(address), max(phone), max(email)
from emp
group by employee_id;Max -
i am new in using Mac operating system, kindly suggest ebooks, videos or audio books to me so that i can learn more about it.
any kind of help would be appriciated. i am very eager to learn.how to make ios application? and how to effectively use terminal? where does the basic programming start in Mac? what are the different tools that can help me make an Mac application and ios application.
-Thank you
Shailendra (India)Apple has got some great guides to start developing in Objective-C, used for programming OS X and iOS apps > http://developer.apple.com/library/mac/#referencelibrary/GettingStarted/RoadMapO SX/chapters/01_Introduction.html
-
While doing union operation, i am getting the following eror.
While doing union operation, i am getting the following eror.
Solution for the following error
"Numbers of columns and their data types must be consistent across all criteria and Result Columns"Hi...phani..thanks for the response..
Report 1: TopN values... working fine
Report2: >TopN values working fine.
when i union the 2 the result is: all records, and i got it.
ReQ: i have to add the remaining Records of >N at the end of the report, represents Others: xxxx
My ReQ:
Col1 Col2 Col3 # of Srs %Of Srs
ABC Complaint Operation 200 40%
CDF ACD Part Availability 100 20%
Others 300 40%
suppose for first column in result tab,
Formula tab: case when saw_4>10 then 'Others' else saw_0 end.
when i put the above condition in Result columns i am getting the error.
Error: Numbers of columns and their data types must be consistent across all criteria and Result Columns
Maybe you are looking for
-
How to attach Documents in a Reply E-mail?
As everyone know that We can upload or attach everything in the camera roll, We can attach other documents like .pdf , .doc etc.. with the help of some external application, but it support only attachment in the form of a new E-mail, But i want to at
-
Keyword problems when editing with CS6
In LR 4.2 and 4.3, when I edit with photoshop and use lightroom corrections, LR creates a new file. I edit it in CS6 and save and close. Back in LR, the file is there, the proper keywords are highlighted and there, but LR cannot find that file. In
-
why is apple requiring me to enter a gift card, credit card or itunes card in order to set up a new account
-
Where is the drop down list with "edit web part" for a list??
In Sharepoint 2010, there was a drop down list to the far right of a list. One of the options was to Edit Web Part. In Sharepoint 2013, I can't find the drop down list. Nothing is to the right of my list and mouse overs down't reveal anything. I
-
Thunderbird dos not appear on Desktop (XP Professional)
Since yesterday's update, when I start Thunderbird, it appears in the task bar, but not on the desktop. Right-clicking it does not give me a menu (it used to be that it opened outside the visible desktop area, but I could select "move" and get it ins