BODI and automatic use of table alias
I have a problem with BODI's automatic use of table alias as the same as the table name, when the table name is a reserved word.
I'm reading from an Informix database, where I've got a table named aggregate. This is a reserved word and gives me problems when BODI is generating the optimized SQL for my select statement.
The generated SQl would look like this (simplified):
SELECT aggregate.aggr_id
FROM informix.aggregate aggregate
This will fail (I'm using an odbc connection), due to syntax error.
Running this within Aqua Studio will also fail. Changing the table alias to aggr will work fine.
My question is how I can prevent or owerride BODI's use of aggregate as the table alias in this case.
Have you tried the Templates?
1. Select Tools > General Options
2. Expand Naming Standards and select Templates
3. Set the template structure you want to use. I used abbreviation (table) or short name(entity) here. i.e use the "Add Variable button to see the options available and add as required. In this instance I'd suggest using the abbreviation e.g. for the primary key I have {table abbr}_PK. Note that you can use "substr" here too.
4. Apply the change and go to the model.
Now these template work in 3 different ways.
1. When transforming or forward engineering the logical to relational models, the templates are applied to the key creation.
2. In the Relational diagram when drawing new relationships between tables or adding new constraints.
3. After the fact, if you apply the templates. Either 1 at a time or globally.
a. To update a single table: To do this select any table and invoke the property palette. Select the Naming Rules button. Check the rules you want to update and click OK. The templates are now applied to your table, renaming the keys.
b. To update multiple tables, select the relational model mode int he Browser, right-click for the context menu and select "Apply Naming Standards" This will update all the items in the model using the template structure set. Please note, regrettably this last (3b), does not work in the latest patch release, but if you are on the initial production release, then the tables are all updated. This has been bugged and fixed and so will be rectified in the next release.
Regards
Sue
Similar Messages
-
Space Allocated and Space used for Table.
Hi,
Is there any way, we can find Space Allocated and Space used for Table wise.
I know USER_TABLESPACES help use to find table space wise. But I would like to know, the space utilized by each table in the specific table space.Check this link from Tom Kyte about it.
http://asktom.oracle.com/pls/asktom/f?p=100:11:2092735390859556::::P11_QUESTION_ID:231414051079 -
Using a table alias to identify row with max timestamp for same ID, syntax?
Hello experts
I have created an alias of a table, so now I have table T1 and its alias T2. (T2 is not joined to anything in the universe currently)
I need to identify the row from T1 with the maximum timestamp for any given ID:
ID Timestamp
1 2011-01-24 16:26:00.000
1 2011-02-24 14:21:00.000
1 2011-02-24 13:49:00.000
I couldn't find anything on the SAP forums, but elsewhere suggested my approach should be thus:
1) Create a table alias (leave it free standing i.e. not joined) - DONE
2) For T1, create a dimension object named Timestamp - DONE
3) Create a seperate predefined condition icon funnel / filter - in the where clause:
T1.timestamp = (SELECT max(T2.timestamp) from T2 WHERE
T1.Key = T2.Key)
I'm stuck with the BO XI 3.1 syntax on step 3. I can't get it to parse.
In the where clause, mine starts with @select(T1\Timestamp) = max(@select(T2\Timestamp)
@where T1.Claim_no = T2.Claim_no)
Please can someone help me with the syntax so this thing will parse.
Many thanks in anticipation.
EddieHi ,
Can you try
SELECT ID, MAX(datetime) FROM T1 GROUP BY by ID
Thanks
Ponnarasu -
Regarding the count(*) while using with table alias
Hi,
I have question in Count(*). Will it work with table allias.
It works when I use like below
"select count(*) po_header_id from po_headers_all" -- its working perfectly
but , when i queried like below its not working,
"select count(*) poh.po_header_id from po_headers_all poh"
I like you guys to clarify my query.
Thanks in advance.
Regards,
Uvarajathe words you write just after a column or an expression or a function will become an ALIAS and aliases don't have any table or scheme.
select count(*) RRRR from mytable;RRRR is an alias in this example. maybe you have a column called RRRR in the table but this is not it. so you can not put your table name as prefix to it. mytable.RRRR will indicate the column not alias. if it doesn't include a dot, it could be used as alias but dot is violating naming rules.
you could do that:
select count(*) "mytable.RRRR" from mytable;now, "mytable.RRRR" becomes your alias. -
Buffer and relate using single table
I have a table with a geometry column representing parcel information with the shape of the parcel. I need to write a query that will select 1 or many parcel(s) from this table based on the parcel ID, but also select all parcels within 300 feet of the selected ones.
So right now I have something like this example to select the parcels based on their ID:
SELECT PARCEL_DATA.ADDRESS,
PARCEL_DATA.CITY,
PARCEL_DATA.STATE,
PARCEL_DATA.ZIP,
PARCEL_DATA.APN
FROM PARCEL_DATA
WHERE PARCEL_DATA.APN IN ('6465', '4654');
I'm not sure where to go from here to also select parcels within 300 feet of each of these 2 that are already selected. I have been trying various queries with using SDO_BUFFER and SDO_RELATE, but nothing has worked. Any help would be much appreciated.
The below query works, but only for one APN. If I add multiple APNs to APN IN (...), I get the error "ORA-01427: single-row subquery returns more than one row". I need this to work for multiple, not just one. Any ideas?
SELECT PARCEL_DATA.ADDRESS,
PARCEL_DATA.CITY,
PARCEL_DATA.STATE,
PARCEL_DATA.ZIP,
PARCEL_DATA.APN
FROM PARCEL_DATA
WHERE SDO_RELATE (PARCEL_DATA.SHAPE,
(SELECT SDO_GEOM.SDO_BUFFER (SHAPE, 300, 1)
FROM PARCEL_DATA
WHERE APN IN ('6465')),
'mask=anyinteract') = 'TRUE';
Edited by: Guddie on Apr 15, 2010 9:00 AMI actually have 2 tables, one table has the Parcel addresses and the other has the Parcel geometry. They are joined using the APN column. So from my previous example, I want to select the address of the Parcel from one table, but I need to use SDO_WITHIN_DISTANCE so I need the geometry from another table. I need to join these two tables using the APN, but I'm not sure how to write that query. How do I work the join into the SDO_WITHIN_DISTANCE solution you provided earlier? What I need to accomplish is illustrated below in the FROM, but it is clearly not correct. Any help would be much appreciated.
SELECT PARCEL_DATA.ADDRESS,
PARCEL_DATA.CITY,
PARCEL_DATA.STATE,
PARCEL_DATA.ZIP,
PARCEL_DATA.APN
FROM (PARCEL_DATA LEFT OUTER JOIN PARCEL_GEOM ON PARCEL_DATA.APN = PARCEL_GEOM.APN) A,
(PARCEL_DATA LEFT OUTER JOIN PARCEL_GEOM ON PARCEL_DATA.APN = PARCEL_GEOM.APN) B
WHERE SDO_WITHIN_DISTANCE(A.SHAPE, B.SHAPE, 'distance=300') = 'TRUE' AND
B.APN IN ('6465', '4654'); -
Import invoices using interface table
Dear all ,
I want to import invoice from legacy system to oracle EBS R12 , and i use interface table to import the invoice.
The problem is when i run Payable open interface import concurrent program to import the invoices , it didn't import any invoices
and the report output didn't show any error or any data according to the invoices.
Report output :
Report Date: 27-JUN-2010 11:25
Page: 1
Payables Open Interface Import Report
Hold Name:
Source Name: Manual Invoice Entry Hold Reason:
Group: GL Date:
Purge: No
Summarize Report N
Report Date: 27-JUN-2010 11:25
Page: 2
Payables Open Interface Import Report
Hold Name:
Source Name: Manual Invoice Entry Hold Reason:
Group: GL Date:
Purge: No
Summarize Report N
So i go to the db and open the interface table and the status was null ,
i dont know why????????Hi ,
100% org_id problem Please check. Same i faced after i update the org_id it is working fine and showing the output with inovice and rejection details also
Thanks
Venkat -
Using 2 tables to edit db information
Hello;
I am writting an edit form type section for a web site and it
uses 2 tables. I have it done in pieces and now am working on
sewing it together. Here is my problem.
First I have 2 tables. One is Categories, and the other is
Projects. here is what sections I have in these 2 tables:
Categories Table:
CategoryID
Name
MYFile
Description
Projects Table:
ProjectID
CategoryID
Name
Description
I have 2 types of edit pages, one is for just adding and
editing the Category Table the other to add and edit the Project
table. Now what I am trying to do it the following. (I am going to
break this down into parts, doing one part at a time. So this is a
multi part question) I want to take the Project page and have the
Category Name be the order by for the page, wich means I need an
innerjoin. I am kind of at a loss how I would write that and still
be able to edit the record without the innerjoin getting in the
way. (This will also be used on the Category page as a nav link to
edit all the projects with the corresponding category and that will
be the only projects that will appear is the ones assigned to that
category.
But first I need just to ORDER BY Categories.Name in my
Querry so that if you just choose to go to this page and view /
edit all categories you can.
Here is my code so far. I need to have the Project manager
page organize all the projects by Category.Name
<cfquery name="proMan" datasource="#sitedatasource#"
username="#siteUserID#" password="#sitePassword#">
SELECT Projects.Name AS PName, Projects.CategoryID,
Projects.ProjectID AS ID
Categories.Name AS CName, Categories.CategoryID
INNERJOIN Projects ON Categories
FROM Projects, Categories
</cfquery>
<head>
</head>
<body>
<cfoutput query="proMan">
Project Name: #PName#
Project category: #CName#
<form action="Project-Action.cfm" method="post">
<input type="hidden" name="ID" value="#ID#">
<input type="submit" name="proj_Edit" value=" Edit ">
<input type="submit" name="proj_Delete" value="Delete">
</form>
</cfoutput>
I know this is wrong, so How do I make it work?
(Then I will go into the next phase of the question about
being able to go from teh Category Manager page to edit the
projects just associated to the respective category, unless it is
easier to do that part now. Then I will post the code from the
Categories page so we can do an innerjoin there and make a link to
edit projects in that category.)
Thank you. I know this is conveluted, but it is a big section
and a lot of little odds and ends to tie in.
Phoenix
</body>Wow. can't believe I missed that..
Ok, now for phase 2 of this.
I need the category-manager page to have a link on it. the
way it is set up is this:
The Category page has and edit category button, and delete
category button. I need to add an edit projects for this category
link. This will link to the Project-manager page we just fixed up
the innerjoin page.
This is my code for teh Category-manager page:
<cfquery name="catMan" datasource="#sitedatasource#"
username="#siteUserID#" password="#sitePassword#">
SELECT Categories.Name AS ViewField1, Categories.CategoryID
AS ID, Projects.ProjectID
FROM Categories INNER JOIN Projects ON Categories.CategoryID
= Projects.CategoryID
</cfquery>
<head>
</head>
<body>
<cfoutput query="catMan">
#ViewField1#
<a href="projectCat-edit.cfm?CategoryID=#ID#"
class="navA">Edit Category</a>
<a href="project-edit.cfm?ID=#ProjectID#"
class="navA">Edit Projects</a>
<form action="ProjectCat-Action.cfm" method="post">
<input type="hidden" name="ID" value="#ID#"><input
type="submit" name="proj_Delete" class="formButtons"
onMouseOver="this.style.backgroundColor='##0099CC'"
onMouseOut="this.style.backgroundColor='##00659A'"
value="Delete"></form>
</cfoutput>
</body>
What do I need to do on the Projects-manager page to make
just the projects attached to selected category appear using the
code posted that was just made with teh innerjoin?
<cfquery name="proMan" datasource="#sitedatasource#"
username="#siteUserID#" password="#sitePassword#">
SELECT Projects.Name AS PName, Projects.CategoryID,
Projects.ProjectID AS ID,
Categories.Name AS CName, Categories.CategoryID
FROM Projects INNER JOIN Categories ON projects.CategoryID =
Categories.CategoryID
ORDER BY Categories.Name
</cfquery>
<head>
</head>
<body>
<cfoutput query="proMan">
Project Name: #PName#
Project category: #CName#
<form action="Project-Action.cfm" method="post">
<input type="hidden" name="ID" value="#ID#">
<input type="submit" name="proj_Edit" value=" Edit ">
<input type="submit" name="proj_Delete" value="Delete">
</form>
</cfoutput>
</body>
Thanks for all the help. I am not sure my category code is
correct, including the link to edit the projects.
Phoenix -
'use dynamic name' and 'caching properites' options for alias table...
Hello everybody,
can anybody please explain 'use dynamic name' and 'caching properites' options for alias tables...
Thanks...
eagerly waiting for a response..
VijayYou want to create dynamic target table name right?
You can refresh a variable like #GET_SESSION
#GET_SESSION= SELECT <%=odiRef.getSession("SESS_NAME")%> FROM DUAL
My tmp table name like TMP_#GET_SESSION
then in your package refresh #GET_SESSION variable and you can use it.
I hope this can be helpful
Thanks -
How to use non-default Alias Table in Analyzer report
Hi,I defined many alias tables in Essbase. I would like to use a different alias table other than the "default" in Analyzer 6.5 report. In the on-line help, it said I can modify in "database connection properties" when first defining a new report to use a specific alias table. It tells me to do the following: Click the "New" toolbar button. Select a Display Type or Layout, and click OK. Right-click a database connection name in the "Select Database Connections" dialog box, and select Modify from the right-click menu.So I did this, but as I did the last-right click, there is no "Modify" option available. Only has "Add New..", "Database Connection Properties.." However, if I defined a new personal database connection using the login user, I can select to use other alias table. But this will go to personal database connection properties.Is it possible to specifically tell Analyzer to use other alias the global level in database connection? What I use to do is to have certain reports to use the default alias, and another to use another alias table. These reports should be able to share across all users.Sam
In deed it is fix in the GA.Another way to set the alias table is to do it in the Admin client. If you add a connexion to a user there is a new 6.5 button "set alias" that allow you to set the default alias table for this specific user. But, it does not exit on a user group level.
-
Sections and Automatic Table of Contents
Hello there,
I have encountered a problem with InDesign while trying to make an automatic TOC for a journal I am working on. It has something to do with Sections.
So I have a book with several indd files. The very first indd file is called "frontpages" which includes the cover page, the inside cover, the leaf page, then two facing pages for the table of contents, then followed by the last page (Letter from the Editor).
This is followed by my second indd file called "newsbeats" which has 5 pages.
Now, what I wanted to do was mark the frontpages' page numbers using lower case roman numerals (i, ii, iii, etc.) Of course I do not want to include the cover page and the inside cover, so I want to start (i) with the leaf page, (ii) and (iii) marks the table of contents pages, and finally (iv) for the Editor's Letter. I did this by starting a section at the leaf page, START PAGE NUMBERNG AT: 1, and selecting the (i, ii, iii...) option. It worked, while leavingboth the cover page and and the inside cover with markers (a) and (b), which I previously set (because I do not know how to just get rid of the page number...)
Now, my book pages actually starts page (1) in the first page of the "newsbeats" document. So to do that, I made another section on the newsbeats first page, START PAGE NUMBERING AT: 1, and selected (1, 2, 3...). That works, too.
So at the moment, I have 3 sections to my page numbers: 1) the lower case letters (a, b) section for the cover page and inside cover, respectively; 2) the roman numerals section (i, ii, iii...) for the leafpage, table of contents, and Editor Letter; and lastly, 3) the arabic letters (1, 2, 3...) starting from the newsbeats document all the way to the last page of the last indd of my book.
Hope it is clear enough. Now here comes the problem:
When I try to create an automatic Table of Contents, it correctly finds my chapters (i used the style for each journal article's title) and lists them. The problem is, the page numbers do not appear correctly. Instead, it shows "a" on EACH AND EVERY table of contents ENTRY. I tried some trial and error, and found out that the pages shown (a bunch of "a") is actually the COVER PAGE'S (a) page number....
I tried for hours searching on topics like "Sections and Automatic TOC" or "How to selectively choose which pages to include in a TOC".. But I found none.
Your help would be really appreciated. I can easily manually type the page numbers (my journal only has 9 articles), but I wanted to do this in a very systematic way, so it would be a lot easier if in any case, there are more than 9 articles for next year's publication.
THANK YOU SO MUCH!
- Larry
PS: I attached a file showing the generated table of contents (on the ii-iii page that I wanted it to appear on), with the frontpages page panel, which shows the page numbering as well. Also I included the Book Panel, so you see how the pages are set up.We definitely experienced the same issue. Seems like pages just get lost. This is the approach I took:
On the groups main page we just added a link called 'View All Articles' wrapped in a h1 tag (to make it very big and visible to the user) using the following url:
search/?q=%20
The resulting page will search for every article with a space in it and return the results. Still not the most elegant solution but it works. I'd like to implement it right into the xsl file but haven't found very much documentation to aid in this. -
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 -
Error When try to use rowid with table alias
I tried to use table alias to test functions of rules manager and met the following problems.
1. I clone tables employees and departments from HR schema.
2. create event_struct as following:
BEGIN
dbms_rlmgr.create_event_struct(event_struct => 't_a');
dbms_rlmgr.add_elementary_attribute(event_struct => 't_a',
attr_name => 'a_employees',
tab_alias => exf$table_alias('employees'));
dbms_rlmgr.add_elementary_attribute(event_struct => 't_a',
attr_name => 'a_departments',
tab_alias => exf$table_alias('departments'));
END;
3. create rule class as following:
BEGIN
dbms_rlmgr.create_rule_class(rule_class => 't_as',
event_struct => 't_a',
action_cbk => 't_acb',
rslt_viewnm => 't_arv');
END;
4. after adding a rule to the rule class, I try to test as the following
DECLARE
r_emp ROWID;
r_dept ROWID;
CURSOR a_cur IS
SELECT emp.ROWID, dept.ROWID
FROM employees emp, departments dept
WHERE emp.department_id = dept.department_id;
i NUMBER := 1;
BEGIN
OPEN a_cur;
LOOP
FETCH a_cur
INTO r_emp, r_dept;
EXIT WHEN a_cur%NOTFOUND;
dbms_output.put_line(i);
i := i + 1;
dbms_output.put_line(r_emp);
dbms_rlmgr.add_event(rule_class => 't_alia',
event_inst => r_emp,
event_type => 'employees');
dbms_rlmgr.add_event(rule_class => 't_alia',
event_inst => r_dept,
event_type => 'departments');
END LOOP;
END;
But I got the following error
SQL> DECLARE
2 r_emp ROWID;
3 r_dept ROWID;
4 CURSOR a_cur IS
5 SELECT emp.ROWID, dept.ROWID
6 FROM employees emp, departments dept
7 WHERE emp.department_id = dept.department_id;
8 i NUMBER := 1;
9 BEGIN
10 OPEN a_cur;
11 LOOP
12 FETCH a_cur
13 INTO r_emp, r_dept;
14 EXIT WHEN a_cur%NOTFOUND;
15 dbms_output.put_line(i);
16 i := i + 1;
17 dbms_output.put_line(r_emp);
18 dbms_rlmgr.add_event(rule_class => 't_alia',
19 event_inst => r_emp,
20 event_type => 'employees');
21 dbms_rlmgr.add_event(rule_class => 't_alia',
22 event_inst => r_dept,
23 event_type => 'departments');
24 END LOOP;
25 END;
26 /
DECLARE
ERROR at line 1:
ORA-06550: line 1, column 36:
PLS-00201: identifier 'AAAVN9AAEAAAQH8AAA' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at "EXFSYS.DBMS_RLMGR", line 974
ORA-06512: at line 18Hello,
Rowids for the individual tables can be added as events only if the rule class is configured as a Composite one. For all other cases, rowids are treated just as data and they should be formatted as string of name-value pairs or instances of AnyData. Your script suggests that you intended to create a composite rule class so that you could add rowids individually. Please recreate the rule class as composite and try again. The error message you received is incorrect and has been fixed to indicate that the error is with the format of the data item passed in.
Hope this helps,
-Aravind. -
Hi All,
I need to get the "Creation Script" of the existing table using c# and without using SMO dlls (is it possible? I don't know).
I.e. In SQL Management Studio -> right click on any table -> Script table as -> Create To - > open in the new query editor window. This will give you the schema of the table with the constraints of the table.
For E.g. In Northwind database, for the table "Categories", I would like to get it as show below
USE [Northwind]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
[CategoryID] [int] IDENTITY(1,1) NOT NULL,
[CategoryName] [nvarchar](15) NOT NULL,
[Description] [ntext] NULL,
[Picture] [image] NULL,
CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED
[CategoryID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
I would like to get the same schema using c#. Please help.
Thanks & Regards,
Kalai.SMO is the easiest way to get this. This is what Management Studio uses. If you can't use SMO, get a Profiler trace of the queries that SMO executes when generating the script and execute the same using ADO.NET.
Regards,
Farooq Mahmud
Support Escalation Engineer
• Microsoft Health Solutions Group -
Using Insert and Delete icons in table control wizard.
Can anyone tell me how to perform a new row insertion or deletion in a table created using the table control wizard.
I see there is a form fcode_insert_row and fcode_delete_row, but dont know how to call them and what parameters to pass and all.
Since iam new to SAP-ABAP, some code samples will be a great help.
Thanks to all in advance.Hi Lavanya ,
You have to add the icons personally in the table control.. . Put fcode for addition button as INSE and delete as DELE ..coding will be already thr in the wizard no need to anything just add icons in the table control by selecting from f4 help on icons option of screen.
Thanks,
Vishnu . -
Macbook Pro keeps saying connection timeout and it used to connect to the internet fine. What's up, why can't it find and automatically connect to the internet anymore???
Like this: https://discussions.apple.com/thread/2775868?tstart=0 ?
Maybe you are looking for
-
How do i delete one of my folders in Itunes Library
Hi im having a problem with my itunes library. I was messing around on Itunes and i found the "Add file to library" button and I clicked it because I wanted to move my music from my file folder to itunes and i went to sync the music and a pop up come
-
I am trying to set up a small virtual company and am not sure how to find topics that discuss how to do it. Sorry if this question has been answered before. We have three computers shared by two users at the main office. Both users have laptops and t
-
what do you guys think about protecting my Mac
-
Update existing Java Mapping in NWDS
Hi, I need to update the existing Java Mapping. I downloaded the existing mapping from imported archive and modified it in NWDS but it is giving lots of errors regarding missing libraries(JARs). I just need to do a small change in code. Can anyone su
-
If I set up an asynchronous web service using JMS transport, would I be able to receive the callbacks in the business service that invokes the ws? Is this the only approach to callbacks that I can use?