Order By clause - View link consistency
Hi,
I have created an EO ( EmpEO ) on EMP table. Created two VOs ( EmpVO and MaxEmpIdVO ) based on EmpEO.
For MaxEmpIdVO,
1. Set the Updatable for EmpEO to false
2. Tuned it to return At Most One Row
3. Set the Order By to "EMPNO Desc"
I want to use this VO to get maximum of EmpNo.
Added these two VOs to AM.
After creating a new EmpVO row, the row gets added to rowset of MaxEmpIdVO also because of view link consistency.
But, when I re-executed the query for MaxEmpIdVO, it resulted in two rows ( the newly added row and the row with maximim empid in DB ). MaxEmpIdVO.first() returns the newly added row though it's not the row with maximum EmpId.
Is it the expected behaviour ?
I was expecting it to return the row with maximum EmpId among the rows in DB and newly added rows through EmpVO as well.
Can anyone please help ?
Look like you are using expert mode VO, in that case this is expected behavior. You can turn OFF the View link consistency for this specific VO by calling setAssociationConsistent(false); in the ViewObjectImpl::create();
Another possibility is to add th custom filtering in the overridden ViewObjectImpl::rowQualifies(ViewRowImpl vr) - http://jobinesh.blogspot.com/2011/03/overriding-rowqualifies-for-in-memory.html
Similar Messages
-
Hi,
I have a doubt regarding Order By Clause in Views.
As per my knowledge, we can't put an order by clause in the subquery that defines view. But when i created a view in Oracle 9i with the order by clause, view got created.
Please see the my view code below :
create or replace view testview
as select * from employees
order by 1,2;
Could anyone please confirm that we can have order by clause in Views in oracle 9i?
Thanks,
TandraAccording to the SQL Reference doc, there is no such restriction for a non-updatable view:
The view subquery cannot select the CURRVAL or NEXTVAL pseudocolumns.
If the view subquery selects the ROWID, ROWNUM, or LEVEL pseudocolumns, those columns must have aliases in the view subquery.
If the view subquery uses an asterisk (*) to select all columns of a table, and you later add new columns to the table, the view will not contain those columns until you re-create the view by issuing a CREATE OR REPLACE VIEW statement.
For object views, the number of elements in the view subquery select list must be the same as the number of top-level attributes for the object type. The datatype of each of the selecting elements must be the same as the corresponding top-level attribute.
You cannot specify the SAMPLE clause.
This restriction exists only for updatable views:
If you want the view to be inherently updatable, it must not contain any of the following constructs:
A set operator
A DISTINCT operator
An aggregate or analytic function
A GROUP BY, ORDER BY, CONNECT BY, or START WITH clause
A collection expression in a SELECT list
A subquery in a SELECT list
Joins (with some exceptions as described in the paragraphs that follow). -
Error : The ORDER BY clause is invalid in views, inline functions, derived
Hi All,
I am on 11g 6.2, Windows Server 2008, my db SQL server 2008, I am facing the error for the reports in which I am trying to edit one the column formula and do something like 'abc/sum(abc)*100'.
10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 16001] ODBC error state: 37000 code: 8180 message: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.. [nQSError: 16001] ODBC error state: 37000 code: 1033 message: [Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
One of the solutions to this which I have found is to edit the EXPRESSION_IN_ORDERBY_SUPPORTED feature in the db properties.
I want to know what does EXPRESSION_IN_ORDERBY_SUPPORTED means?
When I create a calculations in 11g like abc/sum(abc) in the column formula for a column then i get this error.
What does this error mean? Does OBIEE 11g doesn't support using these expressions in the report and the fact that it applies the order by clause to the reports, the report fail?
Could anybody please explain the issue. There is very limited information on this over the web.
Thanks in advance.
RonnyThanks svee for the quick response, actually i had resolved the issue by unchecking the EXPRESSION_IN_ORDERBY_SUPPORTED option in the database. I want to understand how does that makes the difference?
What does EXPRESSION_IN_ORDERBY_SUPPORTED mean? Does it mean that if I give any expression in my answers report and since obiee uses a order by for all the queries, the expression won't be supported?
Please explain. -
View Link Editor Issue - empty query clause if based on association
JDeveloper 10.1.2
Setup:
- entities A and B
- a 1 to * association from entity A to entity B (A_B_association)
- a view of A based on entity A (AView)
- a view of B based on entity B (BView)
- BView has an expert mode query
Create a view link from table A to table B:
- choose the A_B_association under AView for the source attribute
- choose the A_B_association under BView for the destination attribute
- click add
- click next
issue: the query clause is empty
- click next:
info dialog pops up;
title = "Business Components"
message = "Restoring the default where clause."
Note, however, that creating a view link based on the attributes works. That is, if I choose the primary key attribute under AView for the source attribute, and the corresponding foreign key attribute under BView for the destination attribute, then the wizard generates the expected query clause.
If I create a new project and recreate the entities, the views, and the association, then I can successfully create a view link based on the association. The foreignKey value on the association end was different in the new association XML file. I modifed the old XML file so that it used the same foreignKey element, but that did not seem to work.
I am guessing that this is some sort of user error on my part or that we have otherwise managed to squat up our XML files.
Any tips, hints, or ideas appreciated.
Thanks,
SteveThe problem is in AView.
We had modified the AView at one point, then reverted it to a default view of entity A. Here, "a default view" means that we undid our custom changes (apparently not thoroughly enough); that is, we did not delete it and create a default view from scratch using the contextual menu on the A entity.
The bottom line is that the AView attributes were not being mapped to the entity -- they were showing up as calculated attributes.
We created a "New Default View Object..." from the contextual menu of entity A, then manually corrected the AView.xml file to solve the problem. -
Read only view which has an ORDER BY clause
Aim to create a read only view which has an ORDER BY clause
Sample script
CREATE TABLE tab1 (
col1 VARCHAR2(3),
col2 NUMBER
INSERT INTO tab1(col1, col2) VALUES ('ccc', 30);
INSERT INTO tab1(col1, col2) VALUES ('bbb', 20);
INSERT INTO tab1(col1, col2) VALUES ('ddd', 40);
INSERT INTO tab1(col1, col2) VALUES ('aaa', 10);
COMMIT;
-- To creat View
CREATE OR REPLACE VIEW v_tab1
AS
SELECT
col1,
col2
FROM
tab1
ORDER BY
col1
WITH READ ONLY;
I get the following error
WITH READ ONLY
ERROR at line 10:
ORA-00933: SQL command not properly ended
When I comment out the ORDER BY clause, the view is created
Pls let me know how I can create a read only view with ORDER BY clauseHi,
take a look at the documentation for CREATE VIEW, there is a restriction:
"You cannot specify the ORDER BY clause in the subquery if you also specify the subquery_restriction_clause."
Wolfgang -
Materialized view and Order by clause
Hi all. I'd like to have some information regarding the order by clause used in a materialized view.
I'm using Oracle 9.2 and Win2003 server. I have a common view (my_common_view) on which a materialized view is based (my_materialized_view). Materialized view is built for fast refresh and is created in this way:
create materialized view my_materialized_view as
select * from my_common_view
order by 1,2,3;
My question is: if I query this materialized view without adding an order by clause in the statement, I will obtain always an ordered result set? So, is it useful to include the order by clause in the materialized view script or the order by has to be include in the statement used for quering the materialized view (for example like this: select * from my_materialized view order by ...)?
Thank you very much.
Ste.SQL> create table t
2 (x int)
3 /
Table created.
SQL> create view vw
2 as
3 select *
4 from t
5 order by x
6 /
View created.
SQL> select *
2 from v$version
3 /
BANNER
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
PL/SQL Release 9.2.0.7.0 - Production
CORE 9.2.0.7.0 Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.7.0 - Production
NLSRTL Version 9.2.0.7.0 - Production
SQL> -
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 16001] ODBC error state: 37000 code: 8180 message: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.. [nQSError: 16001] ODBC error state: 37000 code: 1033 message: [Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
I have already tried to follow this thread below, but no change.
HI
In this specific report ran above the offending sql uses a CTE.
I am on 11.1.1.6.1, Windows Server 2008
Currently in testing phase in migration from 10g.
I know what the error means, just not how to resolve it or what setting may be causing this.In Physical layer, go to specific database(Physical layer's) properties, database features tab -> Un check the EXPRESSION_IN_ORDERBY_SUPPORTED.
For that failed report, go to Answers-> advance tab-> Look for 'Advanced SQL Clauses'
Check this box to issue an explicit Select Distinct
Let me know updates
If helps Pls mark correct or helpful -
Slow SQL output when table alias is NOT used in order by clause
Hi guys,
My query is based on Oracle 9208
I have a table TAB1 with 68000 records with transaction_id as the primary key in this table (unique index).
I have another TAB2 with the same number of records again with transaction_id in this table (foreign key to above).
I have the below query that gets executed via an application:-
SELECT TO_CHAR(V1.TRANSACTION_ID), V1.POLICY_ID, V1.REQUEST_TYPE
FROM <VIEW> V1 WHERE V1.CERT_SERIAL_NUM=56192 AND
(V1.AUTH_GROUP_ID=0 OR V1.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
BY TRANSACTION_ID ASC
The above view V1 is created as below:-
CREATE OR REPLACE FORCE VIEW "V1"
("TRANSACTION_ID",
"PARENT_TRANSACTION_ID",
"CA_DN_ID",
"AUTH_GROUP_ID",
"POLICY_ID",
"REQUEST_TYPE",
"REQUEST_STATUS",
"EE_DN_HASH",
"EE_DN",
"EE_EMAIL_HASH",
"EE_EMAIL",
"KEY_USAGE",
"SMART_CARD_SERIAL",
"CERT_TYPE",
"CERT_SERIAL_NUM",
"CERT_INDEX",
"RENEWAL_FLAG",
"ARCHIVE_FLAG",
"TIME_RECEIVED",
"DOWNLOADED",
"REQUEST_DATA",
"ACTION",
"STEP_NUM")
AS
SELECT
T1.transaction_id,
T1.parent_transaction_id,
T1.ca_dn_id,
V2.auth_group_id,
V2.policy_id,
T1.request_type,
T1.request_status,
T2.ee_dn_hash,
T2.ee_dn,
T2.ee_email_hash,
T2.ee_email,
T2.key_usage,
T2.smart_card_serial,
T2.cert_type,
T2.cert_serial_num,
T2.cert_index,
T2.renewal_flag,
T2.archive_flag,
T1.time_received,
T1.downloaded,
T1.request_data,
V2.action,
V2.step_num
FROM TAB1
<ANOTHER VIEW> V2,
TAB2 T1,
TAB2 T2
WHERE
T1.transaction_id = T2.transaction_id
AND
V2.policy_id = T1.policy_id
order by transaction_id;
The query at the top runs within milliseconds if the VIEW is created as :-
order by t2.transaction_id
But without the alias "t2" in the order by, the query takes about 1 1/2 minutes
Can you tell me why? I thought if you ordering by primary key (lesser number of values compared to foreign key values), the query should be faster..no?
Thanks in advanceThanks for keeping up with this issue Hemant.
Here are the plans for each case.
I would be very interested in how you'd recognize which plan is the best and what are the derivatives.
I don't much (or rather anything!) what is 'card' values, 'cost' values etc which I believe are used to decide the best plan of the lot.
Thanks again
Note TAB1 and TAB2 are from view definition posted initially
1) Execution Plan for VIEW1 <<-- With ORDER BY" clause but no table ailas (order by transaction_id)
SQL> EXPLAIN PLAN FOR SELECT TO_CHAR(QT.TRANSACTION_ID), QT.POLICY_ID, QT.REQUEST_TYPE
2 FROM <VIEW1> QT WHERE QT.CERT_SERIAL_NUM=24293 AND
3 (QT.AUTH_GROUP_ID=0 OR QT.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
4 BY TRANSACTION_ID ASC
5 /
Explained.
Elapsed: 00:00:01.00
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 195 | 17 |
|* 1 | COUNT STOPKEY | | | | |
| 2 | VIEW | VIEW1 | 17 | 1105 | 17 |
|* 3 | SORT ORDER BY STOPKEY | | 17 | 38573 | 17 |
| 4 | NESTED LOOPS | | 17 | 38573 | 10 |
| 5 | MERGE JOIN CARTESIAN | | 1 | 167 | 9 |
| 6 | VIEW | VIEW2 | 1 | 52 | 8 |
| 7 | SORT UNIQUE | | 1 | 156 | 8 |
| 8 | NESTED LOOPS | | 1 | 156 | 6 |
| 9 | NESTED LOOPS | | 1 | 143 | 6 |
| 10 | NESTED LOOPS OUTER | | 1 | 117 | 5 |
|* 11 | HASH JOIN | | 1 | 104 | 5 |
| 12 | NESTED LOOPS | | 1 | 52 | 2 |
|* 13 | TABLE ACCESS FULL | TAB3 | 1 | 39 | 2 |
|* 14 | INDEX UNIQUE SCAN | (PK_TAB4) | 1 | 13 | |
| 15 | TABLE ACCESS FULL | TAB5 | 82 | 4264 | 2 |
| 16 | VIEW PUSHED PREDICATE | View3 | 1 | 13 | |
| 17 | NESTED LOOPS | | 1 | 52 | 2 |
| 18 | NESTED LOOPS | | 1 | 39 | 2 |
|* 19 | INDEX UNIQUE SCAN | (PK_TAB6) | 1 | 13 | 1 |
|* 20 | INDEX RANGE SCAN | (PK_TAB7) | 1 | 26 | 1 |
|* 21 | INDEX UNIQUE SCAN | (PK_TAB8) | 1 | 13 | |
| 22 | TABLE ACCESS BY INDEX ROWID| TAB9 | 3 | 78 | 1 |
|* 23 | INDEX UNIQUE SCAN | (PK_TAB9) | 1 | | |
|* 24 | INDEX UNIQUE SCAN | (PK_TAB10)| 1 | 13 | |
| 25 | BUFFER SORT | | 1 | 115 | 9 |
| 26 | TABLE ACCESS BY INDEX ROWID | TAB2 | 1 | 115 | 1 |
|* 27 | INDEX RANGE SCAN | (TAB2_IDX2)| 1 | | |
|* 28 | TABLE ACCESS BY INDEX ROWID | TAB1 | 12 | 25224 | 1 |
|* 29 | INDEX UNIQUE SCAN | (PK_TAB1) | 1 | | |
Predicate Information (identified by operation id):
1 - filter(ROWNUM<=3)
3 - filter(ROWNUM<=3)
11 - access("TAB5"."PATH_ID"="TAB4"."PATH_ID")
13 - filter("TAB3"."AUTH_GROUP_ID"<>(-1) AND ("TAB3"."AUTH_GROUP_ID"=0 OR "TAB3"."AUTH_GROUP_ID"=1))
14 - access("TAB3"."PATH_ID"="TAB4"."PATH_ID")
19 - access("TAB5"."DOMAIN_ID"="TAB6"."DOMAIN_ID")
20 - access("TAB6"."DOMAIN_ID"="TAB7"."DOMAIN_ID")
21 - access("TAB7"."RULE_ID"="TAB8"."RULE_ID")
23 - access("TAB9"."POLICY_ID"="TAB5"."POLICY_ID")
24 - access("TAB9"."ASSOCIATED_FORM_ID"="TAB10"."FORM_ID")
27 - access("TAB2"."CERT_SERIAL_NUM"=24293)
28 - filter("View2"."POLICY_ID"="TAB1"."POLICY_ID")
29 - access("TAB1"."TRANSACTION_ID"="TAB2"."TRANSACTION_ID")
Note: cpu costing is off
54 rows selected.
Elapsed: 00:00:01.81
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
Statistics
39 recursive calls
0 db block gets
629 consistent gets
0 physical reads
104 redo size
5169 bytes sent via SQL*Net to client
405 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
31 sorts (memory)
0 sorts (disk)
54 rows processed
2) Execution Plan for VIEW1 <<-- With ORDER BY" clause and table alias (order by TAB2.transaction_id)
SQL> explain plan for SELECT TO_CHAR(QT.TRANSACTION_ID), QT.POLICY_ID, QT.REQUEST_TYPE
2 FROM <VIEW1> QT WHERE QT.CERT_SERIAL_NUM=30003 AND
3 (QT.AUTH_GROUP_ID=0 OR QT.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
4 BY TRANSACTION_ID ASC
5 /
Explained.
Elapsed: 00:00:10.20
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 195 | 14 |
| 1 | SORT ORDER BY | | 3 | 195 | 14 |
|* 2 | COUNT STOPKEY | | | | |
| 3 | VIEW | VIEW1 | 17 | 1105 | 13 |
| 4 | NESTED LOOPS | | 17 | 38573 | 13 |
| 5 | MERGE JOIN CARTESIAN | | 1 | 167 | 12 |
|* 6 | TABLE ACCESS BY INDEX ROWID | TAB2 | 1 | 115 | 4 |
| 7 | INDEX FULL SCAN | (TAB2_IDX) | 94 | | 1 |
| 8 | BUFFER SORT | | 1 | 52 | 8 |
| 9 | VIEW | VIEW2 | 1 | 52 | 8 |
| 10 | SORT UNIQUE | | 1 | 156 | 8 |
| 11 | NESTED LOOPS | | 1 | 156 | 6 |
| 12 | NESTED LOOPS | | 1 | 143 | 6 |
| 13 | NESTED LOOPS OUTER | | 1 | 117 | 5 |
|* 14 | HASH JOIN | | 1 | 104 | 5 |
| 15 | NESTED LOOPS | | 1 | 52 | 2 |
|* 16 | TABLE ACCESS FULL | TAB3 | 1 | 39 | 2 |
|* 17 | INDEX UNIQUE SCAN | (PK_TAB4) | 1 | 13 | |
| 18 | TABLE ACCESS FULL | TAB5 | 82 | 4264 | 2 |
| 19 | VIEW PUSHED PREDICATE | View3 | 1 | 13 | |
| 20 | NESTED LOOPS | | 1 | 52 | 2 |
| 21 | NESTED LOOPS | | 1 | 39 | 2 |
|* 22 | INDEX UNIQUE SCAN | (PK_TAB6) | 1 | 13 | 1 |
|* 23 | INDEX RANGE SCAN | (PK_TAB7) | 1 | 26 | 1 |
|* 24 | INDEX UNIQUE SCAN | (PK_TAB8) | 1 | 13 | |
| 25 | TABLE ACCESS BY INDEX ROWID| TAB9 | 3 | 78 | 1 |
|* 26 | INDEX UNIQUE SCAN | (PK_TAB9) | 1 | | |
|* 27 | INDEX UNIQUE SCAN | (PK_TAB10) | 1 | 13 | |
|* 28 | TABLE ACCESS BY INDEX ROWID | TAB1 | 12 | 25224 | 1 |
|* 29 | INDEX UNIQUE SCAN | (PK_TAB1) | 1 | | |
Predicate Information (identified by operation id):
2 - filter(ROWNUM<=3)
6 - filter("TAB2"."CERT_SERIAL_NUM"=30003)
14 - access("TAB5"."PATH_ID"="TAB4"."PATH_ID")
16 - filter("TAB3"."AUTH_GROUP_ID"<>(-1) AND ("TAB3"."AUTH_GROUP_ID"=0 OR "TAB3"."AUTH_GROUP_ID"=1))
17 - access("TAB3"."PATH_ID"="TAB4"."PATH_ID")
22 - access("TAB5"."DOMAIN_ID"="TAB6"."DOMAIN_ID")
23 - access("TAB6"."DOMAIN_ID"="TAB7"."DOMAIN_ID")
24 - access("TAB7"."RULE_ID"="TAB8"."RULE_ID")
26 - access("TAB9"."POLICY_ID"="TAB5"."POLICY_ID")
27 - access("TAB9"."ASSOCIATED_FORM_ID"="TAB10"."FORM_ID")
28 - filter("VIEW2"."POLICY_ID"="TAB1"."POLICY_ID")
29 - access("TAB1"."TRANSACTION_ID"="TAB2"."TRANSACTION_ID")
Note: cpu costing is off
53 rows selected.
Elapsed: 00:00:08.29
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
Statistics
1079 recursive calls
0 db block gets
597 consistent gets
21 physical reads
0 redo size
5177 bytes sent via SQL*Net to client
405 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
63 sorts (memory)
0 sorts (disk)
53 rows processed
3) Execution Plan for VIEW1 <<-- Without any "ORDER BY" clause
SQL> explain plan for SELECT TO_CHAR(QT.TRANSACTION_ID), QT.POLICY_ID, QT.REQUEST_TYPE
2 FROM <VIEW1> QT WHERE QT.CERT_SERIAL_NUM=30003 AND
3 (QT.AUTH_GROUP_ID=0 OR QT.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
4 BY TRANSACTION_ID ASC
5 /
Explained.
Elapsed: 00:00:10.20
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 213 | 11 |
| 1 | SORT ORDER BY | | 3 | 213 | 11 |
|* 2 | COUNT STOPKEY | | | | |
| 3 | NESTED LOOPS | | 17 | 1207 | 10 |
| 4 | MERGE JOIN CARTESIAN | | 1 | 32 | 9 |
| 5 | VIEW | VIEW2 | 1 | 26 | 8 |
| 6 | SORT UNIQUE | | 1 | 156 | 8 |
| 7 | NESTED LOOPS | | 1 | 156 | 6 |
| 8 | NESTED LOOPS | | 1 | 143 | 6 |
| 9 | NESTED LOOPS OUTER | | 1 | 117 | 5 |
|* 10 | HASH JOIN | | 1 | 104 | 5 |
| 11 | NESTED LOOPS | | 1 | 52 | 2 |
|* 12 | TABLE ACCESS FULL | TAB3 | 1 | 39 | 2 |
|* 13 | INDEX UNIQUE SCAN | PK_TAB4 | 1 | 13 | |
| 14 | TABLE ACCESS FULL | TAB5 | 82 | 4264 | 2 |
| 15 | VIEW PUSHED PREDICATE | VIEW3 | 1 | 13 | |
| 16 | NESTED LOOPS | | 1 | 52 | 2 |
| 17 | NESTED LOOPS | | 1 | 39 | 2 |
|* 18 | INDEX UNIQUE SCAN | PK_TAB6 | 1 | 13 | 1 |
|* 19 | INDEX RANGE SCAN | PK_TAB7 | 1 | 26 | 1 |
|* 20 | INDEX UNIQUE SCAN | PK_TAB8 | 1 | 13 | |
| 21 | TABLE ACCESS BY INDEX ROWID| TAB9 | 3 | 78 | 1 |
|* 22 | INDEX UNIQUE SCAN | PK_TAB9 | 1 | | |
|* 23 | INDEX UNIQUE SCAN | PK_TAB10 | 1 | 13 | |
| 24 | BUFFER SORT | | 1 | 6 | 9 |
| 25 | TABLE ACCESS BY INDEX ROWID | TAB2 | 1 | 6 | 1 |
|* 26 | INDEX RANGE SCAN | TAB2_IDX2 | 1 | | |
|* 27 | TABLE ACCESS BY INDEX ROWID | TAB1 | 12 | 468 | 1 |
|* 28 | INDEX UNIQUE SCAN | PK_TAB1 | 1 | | |
Predicate Information (identified by operation id):
2 - filter(ROWNUM<=3)
10 - access("TAB5"."PATH_ID"="TAB4"."PATH_ID")
12 - filter("TAB3"."AUTH_GROUP_ID"<>(-1) AND ("TAB3"."AUTH_GROUP_ID"=0 OR "TAB3"."AUTH_GROUP_ID"=1))
13 - access("TAB3"."PATH_ID"="TAB4"."PATH_ID")
18 - access("TAB5"."DOMAIN_ID"="TAB6"."DOMAIN_ID")
19 - access("TAB6"."DOMAIN_ID"="TAB7"."DOMAIN_ID")
20 - access("TAB7"."RULE_ID"="TAB8"."RULE_ID")
22 - access("TAB9"."POLICY_ID"="TAB5"."POLICY_ID")
23 - access("TAB9"."ASSOCIATED_FORM_ID"="TAB10"."FORM_ID")
26 - access("TAB2"."CERT_SERIAL_NUM"=1022)
27 - filter("VIEW2"."POLICY_ID"="TAB1"."POLICY_ID")
28 - access("TAB1"."TRANSACTION_ID"="TAB2"."TRANSACTION_ID")
Note: cpu costing is off
52 rows selected.
Elapsed: 00:00:03.37
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
Statistics
38 recursive calls
0 db block gets
287 consistent gets
0 physical reads
0 redo size
5006 bytes sent via SQL*Net to client
405 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
29 sorts (memory)
0 sorts (disk)
52 rows processed -
View link between calculated attributes
Hi all,
I'm having a problem with a view link. See, I'm linking two view objects on attributes that are calculated. The two view objects are result of sql query (not EO based) - plus, this attribute is present in the SQL query and in the db table for both view object.
The SQL query is like, for both view object :
select to_char(DATE_FO, 'dd/MM/yyyy), a, b, from ...
And, as I said, I made a view link on these attributes. The cardinality is 1 to *.
When testing the ApplicationModule, I'm getting
(oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. SELECT ....... ) QRSLT WHERE DATETOCHAR = :Bind_ToCharGdaCrahDateCrahDdMm
----- Level 1: Detail 0 -----
(java.sql.SQLException) ORA-00904: "DATETOCHAR" : identificateur non valide
DATETOCHAR is the alias of the calcultated attribute in detail vo.
Please help ! Also I've been reading Steve's article : urlhttp://radio.weblogs.com/0118231/2003/11/13.html[url] ; what is jbo.viewlink.consistent property exactly ?
Regards
LucHi again,
ok I found it ... I needed to add an alias in the SQL query and override the default sql where clause in the view link. Something weird btw, because the alias in the sql query seems to be not bind to the alias property in the attribute properties... and it add another attribute. But it works fine.
Therefore, if Steve muench might explain jbo.viewlink.consistent property, I'm stil interested in knowing that :)
Luc -
Order by clause being ignored in region definition?
Hi-
I've created an interactive report on a database table. In this report, i'd like my data to display in a certain order initially, but allow it to be changed, if necessary. My query looks like:
select action_year, action_month, action_count , (and so on)
from my_table
order by action_year, action_month, action_count desc
When the report is displayed, the data does not display sorted in the order specified in my SQL (for the first row returned, i'll see '2007' when i have '2008' data in the table). I'm wondering if the "order by" clause is ignored by the APEX query parser and if so, how can i get my data to display in the manner that i am programmatically after. As far as i know, i've not specified any additional sorts on my report data.
cheers,
jim.If you create a view like this:
CREATE VIEW emp_vu
AS
SELECT ename, empno, job, sal, deptno
FROM emp
ORDER BY deptno, enameand use a select in your interactive report
SELECT *
FROM emp_vuthe data will show initialy as it is supposed to. You are
able to sort on it as you need. The only thing you need to
disable (exclude) is the single link column. Apparently, if this
option is enabled, apex sorts on that link value.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Help Urgent! RowIterator retrieval doesn't respect the order by clause.
Hi,
Jdev 10.2.2
I'm using the RowIterator (source iterator) through a defined association to create rows in a destination RowIterator.
The creation of those rows must respect the order clause defined for the ViewObject => source Iterator.
I noticed that when I retrieve the rows through the RowIterator, the order clause is not respected?
Example of implementation:
Pre-defined weight levels for a postal tariff:
Product A:
From weight To weight
0 - 10
10 - 20
The user will have enter a price for each level.
I pre-create those rows so that only the price will have to be entered.
As you see the order of display/creation is important.
I there a way to make the RowIterator respect the Order Clause defined for the ViewObject?
I am a bit worried, please tell it's not the default behaviour!
Thanks
Frederic
For info my code:
RowIterator deliveryWeightIt = weightGroupImpl.getDeliveryWeightAssoc(); // source rows
if (deliveryWeightIt == null)
throw new JboException(getClass().getName()+".setWeightGroupId Detail row generation,. System error. DeliveryWeightAssoc is null.");
deliveryWeightIt.first();
Row currentDeliveryRow = deliveryWeightIt.getCurrentRow();
Row newPostalDetail = null;
try
while (currentDeliveryRow != null)
newPostalDetail = postalDetailIt.createRow();
SequenceImpl s = new SequenceImpl("SITE_POSTAL_REL_SEQ", getDBTransaction());
Number newSeq = s.getSequenceNumber();
System.out.println("numberOfGeneratedRows: "+numberOfGeneratedRows+", newSeq: "+newSeq+", FROMWEIGHT: "+currentDeliveryRow.getAttribute(DeliveryWeightImpl.FROMWEIGHT)); newPostalDetail.setAttribute(PostalDetailImpl.FROMWEIGHT,currentDeliveryRow.getAttribute(DeliveryWeightImpl.FROMWEIGHT));
newPostalDetail.setAttribute(PostalDetailImpl.TOWEIGHT,currentDeliveryRow.getAttribute(DeliveryWeightImpl.TOWEIGHT));
postalDetailIt.insertRow(newPostalDetail);
numberOfGeneratedRows++;
currentDeliveryRow = deliveryWeightIt.next();Ok I think I found my mystake.
I was using the entity association instead of using a view link.
I avoid using links because I encountered Class Cast exception => similar to thread 10.1.2: view Link accessors in entity object return ViewRow ??????
Will there be patch available soon?
Regards
Frederic -
Use View Object with Alternative Data Sources in View Link
In my case, I created a view object based on alternative data source (not with SQL query). I have setQuery(null) in the override create() function for this View Object. When I use this View Object at the destination end of the View Link, the setQuery(null) will raise Jbo-26016 exception (You cannot set customer query (calling setQuery()) on a view object if it is the detail view object in a master detail view link.) which does not allow me to do that. I looked Avrom's Framework for Database API-Based ADF BC, in which he override the DBTransaction and CallableStatement in order to intercept the default query clause set by the View Link. I'd like to see if there is any alternative ways to achieve my objective?
Just following up what I found so far. I'm trying to use customized View Object based on alternative data source at the destination end of View Link with ADF 10.1.3.
1. For the View Object at the destination end of View Link, I can not call setQuery() which will raise Jbo-26016 exception.
2. I can omit the setQuery(null) call in my customized ViewObjectImpl, and as long as there is no SQL statement in the View Definition XML, it won't cause problem when calling the executeQueryForCollection() of the super class.
3. The override executeQueryForCollection() must call the super.executeQueryForCollection() in order to get appropriate result (I tried to skip the call and it does not give back any results)
4. The funny thing is, when I make getQuery() call in my customized ViewObjectImpl (I'm just trying to double check if the Query object is clean or not), the query object is set to "SELECT FROM" following the getQuery() call, and which causes the exceptions when I call super.exeuteQueryForCollection(). I found out later from the Javadoc API which is implemented in that way.
So I guess my case is resolved by not making specific call to setQuery(null). -
Hi,
We have, on default views, defined view links based on the associations between EOs.
More spesific views extend these default views and use the view links extensively.
The problem is that we need the rows retrieved through the VL to be in a specific order.
Is it at all possible to specify the order-by clause for the link?
Sung has posted a sorting routine on his blog - but is this the only way?
Thanks.Hitesh,
This a very generic case and happens when the source VO join attribute and destination VO join attribute are not of same type, i.e. data type and data length. Make sure that is happening in your case, this will solve your problem.
--Mukul -
Suppress "Order By" clause in Answers Query
Hello,
Is it possible to Suppress "Order By" clause in Answers Query.
I'm using a database view as data source. In the view definition, "order by" clause is already specified. Is it possible to get the same order in the OBIEE report??
I do not want to use Sort Order column in the repository.
Thanks,
GirishYou add a rownumber to your DB view and use that to 'sort' your report.
regards
John
http://obiee101.blogspot.com/ -
View Link between two query views
Hi is it possible to create a view link between two views having the where clause bind variables.
How you set the bind variables at the run time for the View objects. It is giving hard time for me to use the Master view in the XmlData bean to generate the Xml document.
I am able to set the Master views bind variables, but for view link destination view
where clause bind variables are not able to set ( link object link condition bind variables are binded run time but the views where chause bind variables of destination view are unable to setand bind)
Thanks
nullEasiest way to do this is to add additional transient attributes to your master view object, and then include those additional transient attributes in the list of source attributes for your view link. This way, you can get BC4J to automatically refer to their values with no additional code on your part.
Maybe you are looking for
-
Opinion on utilizing/storing/managing excess music
Hi - hopefully this is in the right area. I tried to search, but did not find anything relevant to my issue. I have a 4G 20GB iPod and currently have 27GB of music in iTunes. As my immediate collection grows, it's a constant challenge to uncheck 'vic
-
Hi, I'm trying to install javaCC. I hvae downloaded the zip file and extracted it. I set the classpath as C:\Documents and Settings\MyName\Desktop\javacc-4.0\javacc-4.0\bin . When I try to run a .jj program using javacc File.jj in the cmd prompt, it
-
Creating custom ringtones without GarageBand . . . is it possible?
Is it possible to create a custom (original content) ringtone in a pro app such as Final Cut Pro or Soundtrack pro? I removed the consumer apps - Garage Band, iDVD, iMovie - from my system since they never get used. I can always reinstall if necessar
-
I have an assignment due that requires I locate the ROM memory and input/output devices. Where can i find these items? Amanda
-
Hi, Currently I am working on EJB 3 and JBoss 5. I am new to this kind of environment. Now the present application is running on different platform. Basically when the customer/shop owner swipes a card in POS system we get message. Now I need to list