Using DENSE_RANK in Obiee - obiee

someone can explain to me how i apply DENSE_RANK on obiee?
Obiee only have the RANK function, i tried with EVALUATE function but doesn´t work.
Thanks!

How does it "not work"?!
Because it does and your "doesn't work" is probably due to a syntax error.
EVALUATE(‘DENSE_RANK() OVER (PARTITION BY %2 ORDER BY %1)’AS INTEGER,”Org”.”Market”, ”Measures”.”Revenue”)

Related

Obiee 12c DENSE_RANK function

I would like to know if it is possible to execute the dense_rank function in OBIEE12c in another way (for example mathematically), this is because to execute the dense_rank I need to add configs on the server and I don't have access to it.
Thanks.

Vertica fail to execute my query

Working on vertica database currently,faced some error,have no idea for the error so need some helps here :)
below are my query and expected output:
SELECT
country
, merchant
, DISTINCT(merchant)
, COUNT(*) as 'Total Transaction'
, Max(price) as 'Max_Charge'
FROM transaction_table
WHERE ("action")='CHARGE' and action_status='COMPLETED'
GROUP by(msisdn)
my table and expected output
The query does not seem to make a lot of sense, and from what I understood, it has really basic SQL shortcomings, that's why I voted you down. See the explanation below; try to follow the suggestions; and finally edit your question once you've tried something along the lines below.
Looks like going back to the documentation of (any, not just Vertica) SQL could help you a lot:
The DISTINCT keyword is only "legal" directly after SELECT or in COUNT(DISTINCT <expression>)
In a GROUP BY query, the columns in the SELECT list are either columns that will be repeated in the GROUP BY clause, or they are aggregate functions - like your MAX() and your COUNT() . GROUP BY (msisdn) when msisdn is not in the SELECT list won't help at all.
Hope these hints help ---
Good luck
Marco the Sane

SQL Developer Distinct gives ORA-00936

I try to create a query which gives me back how many customer has been registered to our system (using the REGISTERED_ID). However when a customer registrates he can then registrate again with a different car. I want to give back the amount of registers by month. I count the X__INSDATE because basicly I can count anything, all I need is a number. The error points to the DISTINCT, I tried to use having instead of where, but I may missed something.
I use Oracle SQL Developer 4.0.0.12
SELECT
TRUNC(X__INSDATE, 'MONTH') as HONAP,
COUNT(X__INSDATE),
DISTINCT REGISTERED_ID
FROM
DATABASE.data_history
WHERE
DATABASE.data_history.X__INSDATE >= to_date('2013-JÚL. -01', 'YYYY-MON-DD')
GROUP BY TRUNC(X__INSDATE, 'MONTH') ORDER BY HONAP;
Thank you for your help!
You need to apply an aggregate function to all the clauses not on the grup by.
Try with:
SELECT
TRUNC(X__INSDATE, 'MONTH') as HONAP,
COUNT(X__INSDATE),
COUNT(DISTINCT REGISTERED_ID)
Or by grouping as well by REGISTERED_ID

ORA-00907 Missing right parenthesis Postgresql to Oracle

I am moving from Postgres to Oracle and I am getting the ORA-00907 error for the following statement:
UPDATE investigations SET
team=(SELECT team FROM assigned WHERE parent_id=investigations.id LIMIT 1);
Please help with my Oracle syntax.
Thanks in advance!
As far as I know oracle doesn't have LIMIT clause. Take a look at this topic
you can try using rownum
SELECT team FROM assigned WHERE parent_id=investigations.id and rownum =1

Increment Variable/Counter in PL/SQL Select result

A rather silly question. I have a Oracle Db with Products and now read out the first 10 Products.
I now want the following display
1 Product A
2 Product XY
3 Product B
Stupid questions, but how to get the counter in front? I obviously have to increment, but I don't understand how that works. I also thought to work with WITH and tmp table, but can not figure out how that needs to be set up.
SELECT POS ???, PRODUCTNAME FROM TBLPRODUCT
I am not very familiar with PL/SQL. Can someone give me a hint? Thanks so much.
ROWNUM is one approach as shown by Bob, but if you are using more complicated queries -- especially if you are ordering the rows explicitly -- it may not give the results you want.
Nowadays, analytic functions are generally a better approach as you have explicit control over the ordering:
SELECT ROW_NUMBER() OVER (ORDER BY productname), productname
FROM tableproduct
ORDER BY productname
Note that the ordering of the rows which determines the row numbers is separate from the ordering of the overall result set. In this example I've used the same ordering as that's what you're likely to want, but it's worth noting that this gives you more flexibility.
(And apologies for being a little pedantic, but this has nothing to do with PL/SQL, which is the procedural language embedded in Oracle. This is simply about Oracle's implementation of SQL.)
Use ROWNUM, as in
SELECT ROWNUM, PRODUCTNAME FROM TBLPRODUCT
Share and enjoy.

Resources