Generate inline view with "sequence" values 0..36
I want my query to join inline-view that has values from 0..36, what is the best way to create such inline-view?
My initial solution would be:
SELECT LEVEL RESULT FROM Dual CONNECT BY LEVEL < 37
union
select 0 from dual
order by 1I want to write query that outputs the same values as this query i showed.
CharlesRoos wrote:
I want my query to join inline-view that has values from 0..36, what is the best way to create such inline-view?
My initial solution would be:
SELECT LEVEL RESULT FROM Dual CONNECT BY LEVEL < 37
union
select 0 from dual
order by 1I want to write query that outputs the same values as this query i showed.
SELECT (LEVEL - 1) RESULT FROM Dual CONNECT BY LEVEL <= 37 ;Edited by: user503699 on Oct 29, 2010 2:20 PM
Similar Messages
-
OLAP on 11g and Materialised Views with Multiple Value-Based Hierarchies
Hello OLAPians
I am trying to setup Orable BIEE to report on an OLAP cube with pre-aggregated data. As OBIEE is not able to hook into the OLAP directly i have to create an SQL cubeview.
Currently i am on a 10g OLAP environment and am using the oracle sample SQL cubeview generator to create an SQLview of my cube.
The cube itself has multiple dimensions and these dimensions have multiple VALUE-based (ragged) hierarchies and dimension members can be shared across hierarchies also.
Initially i had a problem running the view generator plugin because there is a bug within it that does not finish if there are multiple value-based hierarchies present. I was able to get around this by manually editing the limitmap for the cubeview and manually creating the SQL view.
The question that i want to ask is how robust is the 11g materialised views with multiple value-based hierarchies and the sharing of dimension members across different hierarchies?
Has anyone successfully been able to create a cubeview and import it into OBIEE without the hassle of manually editing the limitmap?
A problem arises with the value-based setup whereby if the client creates a newer depth in the ragged hierarchy, i need to manually create the limitmap and the cube-view over again, and then re-map the BI Administration mappings.The simple answer to your question,
how robust is the 11g materialised views with multiple value-based hierarchies...?is that materialized views are not supported on top of value-based hierarchies in 11g. The reason is that it is not possible to write a reasonable SQL statement that aggregates a fact over a value-based hierarchy. Such a SQL statement is necessary if we want to create a rewritable MV on top of the cube.
But I suspect this is not what you are really asking. If you are trying to set up OBIEE on top of the cube in 10g using the view generator, then you will probably want to use the "ET VIEWS" that are generated automatically in 11g. These are generated whether or not you enable materialized views on top of your cube. I am not aware of any issues with the generated value-based hierarchy view support in 11g. Members may be shared between value hierarchies and you will not need to generate or modify limit maps. -
Materialized View with Sequence
Please help!!
I was wondering if anyone knows how to create a MATERIALIZED VIEW with a generating sequence number (sequence.nextval)???
This is sort of what I want but it doesn't work:
create materialized view ORACLE_AUDIT_LOG_MVW
refresh force start with sysdate
next sysdate + 1
with primary key
as select oracle_seq.nextval,
'Auditing Information' title,
ses.tnsname,
o.obj_owner,
o.obj_name,
o.action_name,
ses.os_username,
ses.username,
ses.machine as machine,
ses.program,
ses.module,
ses.client_ip,
ses.connection_msg,
to_char(ses.logon_time,'DD-MON-YY HH:MM:SS'),
to_char(ses.logoff_time,'DD-MON-YY HH:MM:SS')
from audit_sessions ses, audit_objects o
where ses.tnsname = o.tnsname
and ses.sessionid = o.sessionid
GROUP BY ses.tnsname, O.SESSIONID, o.obj_owner, o.obj_name, o.action_name, ses.os_username, ses.username, ses.machine, ses.program, ses.module, ses.client_ip, ses.connection_msg, ses.logon_time, ses.logoff_time
UNION all
select oracle_seq.nextval,
'Failed Logons' title,
fl.tnsname,
fl.os_username,
fl.username,
fl.terminal as terminal,
fl.connection_msg,
to_char(fl.logon_time,'DD-MON-YY HH:MM:SS'),
from audit_failed_logons fl
Can someone PPPLLLLEEEAAAASSSEE help me???
Thanks so much,
Mary LeeFirst, "doesn't work" isn't particularly descriptive. Error numbers and error messages would be very helpful.
Second, does it have to be a sequence value? Could you not use either ROWNUM or one of the analytic functions (RANK, DENSE_RANK, ROW_NUMBER, etc)?
Third, you'll almost certainly need this MV to be completely refreshed every time...
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Using inline view with NOT IN clause
I have a query with a NOT IN clause in the where clause that I would like to convert to an inline view. The select looks something like this:
select uid, SYSDATE from tab1, tab2
where tab1.uid = tab2.uid
and ...
and tab1.uid not in (select uid from tab3 where....)
I've used inline queries elsewhere to great effect, but this one has me stumped. If anyone can help, it would be greatly appreciated.There can be problem with using not in or not exists depending on the amount of data in the tables and the relationship between them.
I didn't got if you had problem with the existing SQL-statement, created view or both.
Check statistics and look at explain plan for the sql-statement and the view.
The problem can actually be some where clause that you have in the sql-statement but not in the view, but apply later when using the view.
//Anders -
How to generate a view with dynamic name?
I want to generate a view from several tables;
create view sample as select * from book1;
But I hope to create a serial views in my program,that is "sample" maybe "sample20010401" and "sample200010501" ect.If I define a variable,how to pass the value to the view?
Any words are help to me?thanks.
[email protected]
nullUse dynamic SQL
null -
How to get sequence value on click of button in OAF Page
Hi all,
I have a requirement to get a field called Bankrefernece number populated with sequence value on click of apply button ; i mean inserting new record in database for new transaction.
Sequence Value should be something like this:
Example
No Transfer Date Bank Reference Number
(DDMMYY_999)
1 24-Oct-2010 241010_001
2 24-Oct-2010 241010_002
3 25-Oct-2010 251010_001
means every day sequence should start with the date initials.
Kindly give your valuable input.
Thanks
Sims
Edited by: sims on Jan 4, 2011 11:22 PMsims wrote:
Hi Anil,
Its a standard page & i want it on click of apply button but my question is when i click apply button it navigates to other page..is it possible in such scenario to extend the controller.
Thnx for ur suggestion
SimsThat is not an issue, you can extend the controller of that page and get the value of sequence and set it to the VO attribute.
Thanks
--Anil
http://oracleanil.blogspot.com -
Questions on CDS Views with input parameters
Dear Experts,
1. Can we call a CDS View (or generated database view) with input parameters inside an AMDP? I am looking for something similar to the feature in HANA where we can consume calculation view with filters inside SQL Script?
2. I understand we can next CDS Views, but how we can next (call) a CDS View with input parameters inside another CDS View?
Thanks,
GiriHi Thomas,
I get the below error that the CDS View's generated table function cannot take field from AMDP.
I have a requirement to query the CDS View using 2 timestamps (start & end). So, in AMDP I have used the TIME_STAMP and try to pass it to the CDS View
View code:
define view Z_Ngi_Cag_A
with parameters start_ts:abap.dec( 15, 0 ) , end_ts:abap.dec( 15, 0 )
as select from table {
resource_key
where
(begtstmp > $parameters.start_ts or endtstmp > $parameters.start_ts )
and
(begtstmp < $parameters.end_ts or endtstmp < $parameters.end_ts )
I am calling using the below AMDP:
DECLARE iv_start_date TIMESTAMP;
DECLARE iv_end_date TIMESTAMP;
SELECT CURRENT_TIMESTAMP INTO iv_start_date from dummy;
SELECT ADD_DAYS(CURRENT_TIMESTAMP, 30) INTO iv_end_date from dummy;
et_data = SELECT * FROM ZMR_H_CA ( start_ts => iv_start_date, end_ts => iv_end_date );
What could be wrong ? Is this not supported?
Thanks,
Giri -
Question regarding an inline view or function inside SQL
Hi All,
I want to know whether using an inline view with in an sql query is better or a function call within the sql query is better.
When I check the explain plan in both the case I can see no difference in the cost.
Appreciate your valuable suggestions on this.
Thanks,
Maddy K.Hi, Maddy,
It depends. The answer to this kind of question is always "it depends" on several factors. It would help if you gave a specific example.
In general, a function is not an alternative to an in-line view. They're so different, that I suspect I don't really understand the question. Also, I don't understand why you're concerened with in-line views, and not with, for example, regular views or WITH clause sub-queries.
In general, calling user-defined functions from SQL statements is slow. If there's a simple way to get the same results without calling a user-defined function, then it will probably be faster not to call the function.
Don't pay much attention to the cost that explain plan gives it. It doesn't mean much to you. -
Issues with Sequence Generator
I'm having trouble with Sequence generator not generating continuous numbers starting from 1, each time I run the mapping.
I want the Sequence to start from 1, each time the mapping is run. For this to happen, I'm using a pre-mapping operator which uses an oracle procedure to reset the sequence.
But, the sequence generates the numbers from some weird number, say 3508 and then jumps to 5006 and so on. I'm not able to track what's wrong with the sequence. I have stopped the caching in Sequence but still it hasn't helped. I'm sure and have verified that the procedure being used to reset the sequence is running fine.
Please suggest some additional parameters/properties at OWB level to be checked for the sequence, if any OR any thoughts on why the sequence is not starting from 1. Thanks in advance.
Thanks,
Sachin
Edited by: 850549 on Apr 23, 2011 11:43 AM
Edited by: 850549 on Apr 23, 2011 11:44 AMCould you check whether the sequence you use has a cache value greater than 1 defined in the database. This way if your database regularly should be stoped, e.g for offline backup, you'll loose the sequence values that were unused in memory at that time. That way the gaps in your surrogate ids would be explainable.
-
Difference between INLINE view and WITH clause
Can anyone plz explain me about the performance difference between the below queries?
Query using INLINE view:
SELECT e.ename AS employee_name,
dc.dept_count AS emp_dept_count
FROM emp e,
(SELECT deptno, COUNT(*) AS dept_count
FROM emp
GROUP BY deptno) dc
WHERE e.deptno = dc.deptno;
Query using WITH clause:
WITH dept_count AS (
SELECT deptno, COUNT(*) AS dept_count
FROM emp
GROUP BY deptno)
SELECT e.ename AS employee_name,
dc.dept_count AS emp_dept_count
FROM emp e,
dept_count dc
WHERE e.deptno = dc.deptno;Here's another one:
http://www.oracle-base.com/articles/misc/WithClause.php
And, here on this forum you will see that the WITH-clause is heavily used by all of us in order to generate some sample data (when OP's don't care to post CREATE TABLE + INSERT INTO statements).
The WITH clause enables you as well to 'pretend' you have a table and demonstrate a solution very quickly, without doing actual DDL .
As for the performance difference:
We would need to know your database version and many other things.
See:
HOW TO: Post a SQL statement tuning request - template posting
for step by step instructions you can (and should) explore yourself. -
Passing a value to Inline View WHERE clause through JDev...
Hi ,
I need to pass a value to inline view which is mentioned in below VIEW query.
That view is created inside a view using jDev. Note that there are two WHERE clauses one in the Main query and the other in the Inline view.
How to set the value for the innerView.
//copied the code from Java
view.volAlertsHistroyView.setWhereClauseParam(1, new Integer(clientId));
Gives an error Missing IN or OUT parameter at index:: 1
SELECT Alerts.SEND_TIME,
Alerts.STATUS,
Alerts.TEXT ,
Groups.NAME,
VolRoles.ROLE_NAME,
VolRoles.ID as vid,
Groups.ID as gid
FROM ALERTS Alerts, ALERTS_GROUPS AlertsGroups, GROUPS Groups, VOL_ROLES VolRoles,
--Inline view starts
(SELECT GRP_ID, VRL_ID FROM vol_groups WHERE cli_id = :1) user_group_role
--Inline view ends
--Actual WHERE clause starts
WHERE ((Alerts.ID = AlertsGroups.ALT_ID)AND (AlertsGroups.GRP_ID = Groups.ID))AND (AlertsGroups.VRL_ID = VolRoles.ID)
AND AlertsGroups.VRL_ID = user_group_role.VRL_ID AND AlertsGroups.GRP_ID = user_group_role.GRP_ID
Please get back to me .
Regards
Mohan
[email protected]What happens when you change your Java code to:
view.volAlertsHistroyView.setWhereClauseParam(0, new Integer(clientId));
The ":1" does not directly relate to the where clause param index you use in Java. In your query you could also use a ":2" for example. In BC4J you still use "0" for the first param.
Sascha -
ERS generated document with zero value for SES
Hi,
I have maintained service entry sheet.
Accounting entry is generated.
When I run T code MRRL, it has generated document with zero value.
This is not a free goods PO.
Why this is happening?
Please guide on this issue.
Regards,
PiyushHi,
Creating an ERS zero document is an expected system behavior ,you
could create an ERS zero document by doing the following wrong
procedure:
1. Create PO with ERS falg ON.
2. Perform GR for PO.
3. Create the invoice by MIRO.(Not MRRL).
4. Run MRRL (LIV-ERS).
For every purchase order with flag 'ERS' a table entry is generated.
If a goods receipt is posted, this GR should be invoiced via ERS
(Tr. MRRL). Manually posted invoices should be avoided, because
the table entry will not be deleted. A new invoice receipt must be
created while running ERS (but with amount and quantity zero and without
FI documents) in order to give a message to the vendor because he
has sent you an invoice by mistake.
Could you please check also the note:1069215
Best regards
Erika -
How to select value from database view with * in wher clause
Hi ,
I ahve a database view with some fields.
Now my requirement is to serach a single row on the basis of process type.
Process type can have values like ZBA,ZBC,ZBD,ZBE or similarly anything starting with ZB.
Now i know that starting two letters will be ZB , but dont knwo the last letter.
So how should i use select query for the same?
Should i use like operator for the same?
regards
PGhi,
u can use character '%'.sample code like this
SELECT reltype
instid_a
catid_a
instid_b
FROM /dbm/ord_docflow
INTO TABLE it_link
FOR ALL ENTRIES IN it_pnwtyh
WHERE instid_a = it_pnwtyh-instid_a AND
instid_b LIKE 'QMSM%' AND
typeid_a = 'BUS2400' AND
typeid_b = 'BUS2400' AND
catid_a = 'BO' AND
catid_b = 'BO' AND
reltype = 'VONA'.
this is similar to using* while we fetch values from table.in the above code only i no QMSM rest values not sure,so used QMSM% -
Issue with Inline View Criteria
Hi,
I have a VO created on two tables that are joined by a 1:1 association(say Opportunity and Revenue). The query is specified in Expert mode because I need some aggregations performed using analytic functions. Data security predicates are applied on top of this query using a dummy View Criteria. My requirement now is that I need to filter these results using another VC. The issue is that both the tables have attributes with the same name(say Cust ID) and I need to filter based on this using an inline View Criteria. I have done the same declaratively. However, I get an error on hitting the page saying the columns have been ambiguously defined.
On digging through the log, I discovered the test Query fails to prefix the alias before the attribute. So what I get is something similar to this
select (o.id, r.amt, sum(), count(), avg(), o.custId) from opty o, revn r where (o.id in DATA SECURITY PREDICATE) and (custId = :bindCustId)
Is there a way to ensure that the custId can be changed to o.custId???
Note - The View Criteria was created on an attribute from opty table that was exposed i.e in this case, o.custId. Although the query builder shows it correctly while creating the VC declaratively, the issue persists as seen from the logs.
Thanks,
ManojHi experts...
Any pointers to this issue???
Please help!
Regards,
Debolina -
How to create a view with a column of counts of the occurence of values
If my table is:
ID
1
2
3
3
5
5
5
I want to create a view with the following result:
ID COUNT
1 1
2 1
3 2
5 3
How would I accomplish this?Sorry, my mistake. I was thinking about counting distinct events.
I created a table with your example values:
You should do a projection with a calculated column = 1:
And then add this calculated column as an aggregated measure on the aggregation node:
Result:
Cheers,
Fernando
Maybe you are looking for
-
Some e- mail attachments won't open on my iPad Air w/ 7.1.2., some does. There is this sort of link on the bottom of the e-mails that says "download full attachment " and when pressed sometimes the attachment opens but sometimes it simply disappear
-
db11gxe , apex 4.0 , firefox 24 , hi all , i have a master detail page , with an item "test_id" as a select list , and a detail region has also a column "test_id" , what i want is : when i change the value of the master "test_id" , the data is retrie
-
Getting error when running Zprogram
Hi Team, When I am running one Z program 'ZINRPP33' I am getting below errors. Centre of excellence not maintained BOM does not exist No. of stacked pallets value not maintained Could you please suggest solution for it. Thanks in advance.....!!!! Wit
-
My PC died an now CS4 says the serial # is in valid on the new machine. What do I do?
-
TS2972 How can I deauthorise a computer I have not got anymore
How can I deauthorise a computer I haven't got any more I am trying to get home share on a new laptop with iTunes Match but it says I have 5 computers already But when I looked at the devices it says I only have 3 That is Mac mini ,ipad2,iPhone 4s I