How to find the views created on a table..?
Hi all,
I am having one table name, EMP. I want to know what are the views created on this table. Is there any SQL query is there for this or any another
way to find it.
Thanks in advance.
Pal
You can use ALL_DEPENDENCIES for that:
SQL> create view emp_v as select * from emp;
View created.
SQL> select name
2 , referenced_name
3 , referenced_type
4 from all_dependencies
5 where name = 'EMP_V';
NAME REFERENCED_NAME REFERENCED_TYPE
EMP_V EMP TABLE
1 row selected.
SQL> select name
2 , referenced_name
3 , referenced_type
4 from all_dependencies
5 where referenced_name = 'EMP';
NAME REFERENCED_NAME REFERENCED_TYPE
EMP_V EMP TABLE
EMP_TRG EMP TABLE
2 rows selected.
SQL> Keep in mind that it matters whether you restrict on NAME or on REFERENCED_NAME.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1041.htm#sthref935
edit
Ah, spoonfeeding!
Don't you want him to learn something, and to become independent?Now you made me feel guilty ;) ( don't know what Saubhik posted originally, but anyway...)
I blame my currently terribly slow connection for that...
Anyway, OP, always start a quick search from the docs first.
Chances are you'll find your answer yourself.
Homes:
http://www.oracle.com/pls/db102/homepage
http://www.oracle.com/pls/db112/homepage
Edited by: hoek on Oct 15, 2010 2:53 PM
Similar Messages
-
How to see the views created on a table
Dear all,
Please let me know the procedure to find out "the views created on a perticular table"CKPT wrote:
Did OP mentioned ? :(
change the query as
select a.view_name,b.table_name from dba_views a, dba_tables b where a.owner='user1' b.owner='user2' and b.table_name='table' and a.owner='user';simpleWhat is that query supposed to return ?
<s>It will do a scalar product between DBA_VIEWS and DBA_TABLES returning one single table name for every single view over your db without any link together except they have the same owner. Very useful, very helpful.</s><br>
I misread the query, it is even worse than I thought, the query will return nothing. Nothing because a.owner cannot be equal to user1 and to user in the same time.
I think Girish give a much better solution with DBA_DEPENDENCIES.
Nicolas.
Edited by: N Gasparotto on Aug 12, 2010 12:48 PM -
How to find the objects created in last one year
Hi Experts,
How to find the objects created in last one year.
Thanks in Advance,
Iffhi
just go through this table.
<b>TADIR</b> object as 'PROG'
in this you can also provide the authors name in AUTHOR field
and
<b>TRDIRT</b>
reward points if it helps,
regards, -
How to find the level of each child table in a relational model?
Earthlings,
I need your help and I know that, 'yes, we can change'. Change this thread to a answered question.
So: How to find the level of each child table in a relational model?
I have a relacional database (9.2), all right?!
O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
/↑\ Fks
O"O O" <-- level 2 for first table (circle)
/↑\ Fks
"o"o"o" <-- level 1 for middle table (circle)
↑ Fk
"º"Tips:
- each circle represents a table;
- red tables no have foreign key
- the table in first line of tree, for example, has level 3, but when 3 becomes N? How much is N? This's the question.
I started thinking about the following:
First I have to know how to take the children:
select distinct child.table_name child
from all_cons_columns father
join all_cons_columns child
using (owner, position)
join (select child.owner,
child.constraint_name fk,
child.table_name child,
child.r_constraint_name pk,
father.table_name father
from all_constraints father, all_constraints child
where child.r_owner = father.owner
and child.r_constraint_name = father.constraint_name
and father.constraint_type in ('P', 'U')
and child.constraint_type = 'R'
and child.owner = 'OWNER') aux
using (owner)
where child.constraint_name = aux.fk
and child.table_name = aux.child
and father.constraint_name = aux.pk
and father.table_name = aux.father;Thinking...
Let's Share!
My thanks in advance,
Philips
Edited by: BluShadow on 01-Apr-2011 15:08
formatted the code and the hierarchy for readbilityJustin,
Understood.
Nocycle not work in 9.2 and, even that would work, would not be appropriate.
With your help, I decided a much simpler way (but there is still a small problem, <font color=red>IN RED</font>):
-- 1
declare
type udt_roles is table of varchar2(30) index by pls_integer;
cRoles udt_roles;
begin
execute immediate 'create user philips
identified by philips';
select granted_role bulk collect
into cRoles
from user_role_privs
where username = user;
for i in cRoles.first .. cRoles.count loop
execute immediate 'grant ' || cRoles(i) || ' to philips';
end loop;
end;
-- 2
create table philips.root1(root1_id number,
constraint root1_id_pk primary key(root1_id)
enable);
grant all on philips.root1 to philips;
create or replace trigger philips.tgr_root1
before delete or insert or update on philips.root1
begin
null;
end;
create table philips.root2(root2_id number,
constraint root2_id_pk primary key(root2_id)
enable);
grant all on philips.root2 to philips;
create or replace trigger philips.tgr_root2
before delete or insert or update on philips.root2
begin
null;
end;
create table philips.node1(node1_id number,
root1_id number,
node2_id number,
node4_id number,
constraint node1_id_pk primary key(node1_id)
enable,
constraint n1_r1_id_fk foreign key(root1_id)
references philips.root1(root1_id) enable,
constraint n1_n2_id_fk foreign key(node2_id)
references philips.node2(node2_id) enable,
constraint n1_n4_id_fk foreign key(node4_id)
references philips.node4(node4_id) enable);
grant all on philips.node1 to philips;
create or replace trigger philips.tgr_node1
before delete or insert or update on philips.node1
begin
null;
end;
create table philips.node2(node2_id number,
root1_id number,
node3_id number,
constraint node2_id_pk primary key(node2_id)
enable,
constraint n2_r1_id_fk foreign key(root1_id)
references philips.root1(root1_id) enable,
constraint n2_n3_id_fk foreign key(node3_id)
references philips.node3(node3_id) enable);
grant all on philips.node2 to philips;
create or replace trigger philips.tgr_node2
before delete or insert or update on philips.node2
begin
null;
end;
create table philips.node3(node3_id number,
root2_id number,
constraint node3_id_pk primary key(node3_id)
enable,
constraint n3_r2_id_fk foreign key(root2_id)
references philips.root2(root2_id) enable);
grant all on philips.node3 to philips;
create or replace trigger philips.tgr_node3
before delete or insert or update on philips.node3
begin
null;
end;
create table philips.node4(node4_id number,
node2_id number,
constraint node4_id_pk primary key(node4_id)
enable,
constraint n4_n2_id_fk foreign key(node2_id)
references philips.node2(node2_id) enable);
grant all on philips.node4 to philips;
create or replace trigger philips.tgr_node4
before delete or insert or update on philips.node4
begin
null;
end;
-- out of the relational model
create table philips.node5(node5_id number,
constraint node5_id_pk primary key(node5_id)
enable);
grant all on philips.node5 to philips;
create or replace trigger philips.tgr_node5
before delete or insert or update on philips.node5
begin
null;
end;
-- 3
create table philips.dictionary(table_name varchar2(30));
insert into philips.dictionary values ('ROOT1');
insert into philips.dictionary values ('ROOT2');
insert into philips.dictionary values ('NODE1');
insert into philips.dictionary values ('NODE2');
insert into philips.dictionary values ('NODE3');
insert into philips.dictionary values ('NODE4');
insert into philips.dictionary values ('NODE5');
--4
create or replace package body philips.pck_restore_philips as
procedure sp_select_tables is
aExportTablesPhilips utl_file.file_type := null; -- file to write DDL of tables
aExportReferencesPhilips utl_file.file_type := null; -- file to write DDL of references
aExportIndexesPhilips utl_file.file_type := null; -- file to write DDL of indexes
aExportGrantsPhilips utl_file.file_type := null; -- file to write DDL of grants
aExportTriggersPhilips utl_file.file_type := null; -- file to write DDL of triggers
sDirectory varchar2(100) := '/app/oracle/admin/tace/utlfile'; -- directory \\bmduhom01or02
cTables udt_tables; -- collection to store table names for the relational depth
begin
-- omits all referential constraints:
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', false);
-- omits segment attributes (physical attributes, storage attributes, tablespace, logging):
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', false);
-- append a SQL terminator (; or /) to each DDL statement:
dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
-- create/open files for export DDL:
aExportTablesPhilips := utl_file.fopen(sDirectory, 'DDLTablesPhilips.pdc', 'w', 32767);
aExportReferencesPhilips := utl_file.fopen(sDirectory, 'DDLReferencesPhilips.pdc', 'w', 32767);
aExportIndexesPhilips := utl_file.fopen(sDirectory, 'DDLIndexesPhilips.pdc', 'w', 32767);
aExportGrantsPhilips := utl_file.fopen(sDirectory, 'DDLGrantsPhilips.pdc', 'w', 32767);
aExportTriggersPhilips := utl_file.fopen(sDirectory, 'DDLTriggersPhilips.pdc', 'w', 32767);
select d.table_name bulk collect
into cTables -- collection with the names of tables in the schema philips
from all_tables t, philips.dictionary d
where owner = 'PHILIPS'
and t.table_name = d.table_name;
-- execution
sp_seeks_ddl(aExportTablesPhilips,
aExportReferencesPhilips,
aExportIndexesPhilips,
aExportGrantsPhilips,
aExportTriggersPhilips,
cTables);
-- closes all files
utl_file.fclose_all;
end sp_select_tables;
procedure sp_seeks_ddl(aExportTablesPhilips in utl_file.file_type,
aExportReferencesPhilips in utl_file.file_type,
aExportIndexesPhilips in utl_file.file_type,
aExportGrantsPhilips in utl_file.file_type,
aExportTriggersPhilips in utl_file.file_type,
cTables in out nocopy udt_tables) is
cDDL clob := null; -- colletion to save DDL
plIndex pls_integer := null;
sTableName varchar(30) := null;
begin
for i in cTables.first .. cTables.count loop
plIndex := i;
sTableName := cTables(plIndex);
* Retrieves the DDL and the dependent DDL into cDDL clob *
* for the selected table in the collection, and writes to file.*
begin
cDDL := dbms_metadata.get_ddl('TABLE', sTableName, 'PHILIPS');
sp_writes_ddl(aExportTablesPHILIPS, cDDL);
exception
when dbms_metadata.object_not_found then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', sTableName, 'PHILIPS');
sp_writes_ddl(aExportReferencesPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'PHILIPS');
sp_writes_ddl(aExportIndexesPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('OBJECT_GRANT', sTableName, 'PHILIPS');
sp_writes_ddl(aExportGrantsPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
begin
cDDL := dbms_metadata.get_dependent_ddl('TRIGGER', sTableName, 'PHILIPS');
sp_writes_ddl(aExportTriggersPhilips, cDDL);
exception
when dbms_metadata.object_not_found2 then
null;
end;
end loop;
end sp_seeks_ddl;
procedure sp_writes_ddl(aExport in utl_file.file_type,
cDDL in out nocopy clob) is
pLengthDDL pls_integer := length(cDDL);
plQuotient pls_integer := null;
plRemainder pls_integer := null;
begin
* Register variables to control the amount of lines needed *
* for each DDL and the remaining characters to the last row. *
select trunc(pLengthDDL / 32766), mod(pLengthDDL, 32766)
into plQuotient, plRemainder
from dual;
* Join DDL in the export file. *
* ps. 32766 characters + 1 character for each line break. *
-- if the size of the DDL is greater than or equal to limit the line ...
if plQuotient >= 1 then
-- loops for substring (lines of 32766 characters + 1 break character):
for i in 1 .. plQuotient loop
utl_file.put_line(aExport, substr(cDDL, 1, 32766));
-- removes the last line, of clob, recorded in the buffer:
cDDL := substr(cDDL, 32767, length(cDDL) - 32766);
end loop;
end if;
* If any remains or the number of characters is less than the threshold (quotient = 0), *
* no need to substring. *
if plRemainder > 0 then
utl_file.put_line(aExport, cDDL);
end if;
-- record DDL buffered in the export file:
utl_file.fflush(aExport);
end sp_writes_ddl;
begin
-- executes main procedure:
sp_select_tables;
end pck_restore_philips;<font color="red">The problem is that I still have ...
When creating the primary key index is created and this is repeated in the file indexes.
How to avoid?</font> -
How to find the structural difference between two tables
Hi all,
How to find the structural difference between two tables .
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Thanks,
P Prakashyou could try something similar to this, for each table pair that you want to compare:
SELECT 'TABLE_A has these columns that are not in TABLE_B', DIFF.*
FROM (
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_A'
MINUS
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_B'
) DIFF
UNION
SELECT 'TABLE_B has these columns that are not in TABLE_A', DIFF.*
FROM (
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_B'
MINUS
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_A'
) DIFF;that's assuming, column_name, data_type and data_length are all you want to compare on. -
How to find the programs created by date
Hi all
I would like to find the programs created by date and by report title. Is there any report to find programs by date or by report title..?
Thanks
Prasead KHi ,
Can anybody tell me how fo find out the date on which a Tcode was created?
Thanks,
Manjula.s -
How to find the container in goods receipt table
hi,
how to find the number of containers with respect to each material document. After posting the material document the number of containers cannot stored in MSEG or MKPF table. i can able to find only in QALS table but how to link the material document and inspection lot.
Thanks
Muthuraman.DHi Muthuraman,
Can you check this bapi BAPI_INSPLOT_GETLIST.In this bapi there is a different selection criteria like material,material document no and all. I think you can use this for your report. Check this and post if need help.
Regards,
Madhu. -
How to find the LOCKED ROWS in a table?
Not locked objects, but for a table the locked rows.
Check below links :
http://www.jlcomp.demon.co.uk/faq/locked_rows.html
How to find the locked row.
who are waiting for same record?
HTH
Girish Sharma -
How to find the function module for standard tables.
Hi
Could any one please tell me how to find the standard function module to update the standard tables
Thanks & Regards
SowmyaHi sowmya,
To find the function modules for standard tables you go for a where used list of that particular table and check only function module interfaces checkbox...
and more over you can go for DB_UPDATE_TABLE will be the function module for updating database table..
Hope this information would help you
Regards
Narin Nandivada -
How to find the longest record in a table?
Hello,
Is there a function to find the longest record in a table? Or is there a data dictionary that would tell you which record contains the longest data?
I have a table with five columns and one million records. I want to find the record (5 columns combined) with the longest data. Thank you.Dear watson2000!
The function "VSIZE" tells you the number of bytes in the internal representation of a column which means the size of a value within a column. An example of vsize can be found here:
[http://www.adp-gmbh.ch/ora/sql/vsize.html]
So I think you should try it with this query to get the size of the longest record:
SELECT MAX(VSIZE(column1)) +
MAX(VSIZE(column2)) +
MAX(VSIZE(column3)) +
MAX(VSIZE(column4)) +
MAX(VSIZE(column5)) AS "Maximum Row"
FROM your_table;To identify the longest record try like this:
SELECT rowid
FROM your_table
GROUP BY rowid
HAVING (MAX(VSIZE(column1)) +
MAX(VSIZE(column2)) +
MAX(VSIZE(column3)) +
MAX(VSIZE(column4)) +
MAX(VSIZE(column5))) = (SELECT MAX(VSIZE(column1)) +
MAX(VSIZE(column2)) +
MAX(VSIZE(column3)) +
MAX(VSIZE(column4)) +
MAX(VSIZE(column5))
FROM your_table;)I hope that these two queries could be of help to you.
yours sincerely
Florian W.
Edited by: Florian W. on 23.04.2009 20:53 -
How to Find the Explicitly Created Schemas in the Database?
Hi,
I am Using Oracle 11g Database R1 on Windows 2003 Server R2 , My Doubt is How Can i find the list of Schemas are explicitly created in the Database , We can Query this Tables DBA_USER Or SYS.USER$ to find the List of Available Schemas ( But it shows all implicity + Explicitly Created Schemas), I need the exact list of Schema Which created explicitly in the Database is there any Data Dictionary Views is Available , Please Advice .....
Thank You
ShanBut yes, you can get from below SQL :
select a.username,a.created from dba_users a,v$database b
where a.created > b.created;
Means, users which created after creation of database date. -
How to find out who created a custom table
I have searched the forum but didn't find an answer so thought I would put it out here.
I have a bunch of custom tables that have been created and not assigned to table groups. Some are SM30 wrappers and some aren't. They are all defaulted to &NC& which is a no-no to assign to roles. My question is, how can I see who created these tables so that I can contact them and educate them on table groups? I can't seem to figure this out.
For instance, I have a custom t-code that calls a custom view and the view is assigned to &NC& in TDDAT.
Any help appreciatedBobbi,
Try SE15->ABAP Dictionary->Database Tables->"enter table name" and execute->select table and view->Attributes Tab->Last changed on/by. Field "Last changed on/by" will give you an idea who the last user that made modification on this table.
Good Luck
-John N. -
How to find the sum of an advanced table column?
Hi All,
Good Morning..
I have requirement where i need to calculate the sum of a column in an advanced table.and i need to put that value into some other field.
i am doing customization so i can't touch the Standard page properties.so i need to achieve it through Pro-grammatically..
my column name is unit price in the advanced table region.so i need the code to calculate the sum of the unit price.
Thanks in advance
BharatHi Bharat,
No need for Programatic way as Advanced Table already provides this facility.
The following steps describe how to enable Totaling for a column in the footer of an advanced table.
Step 1: In the Structure pane of OA Extension, select the column container for which you want to enable Totaling Any column except for the first column can be totaled. Set the Total Value property for this column container to True.
Step 2: In the Structure pane, select your advancedTable region and choose New > footer from the context menu. OA Extension creates an advancedTables Components folder containing a footer named child, that contains a tablefooter container (labeled tableFooter1).
Step 3: Select the tableFooter container and choose New > total from the context menu. OA Extension creates a tableFooter Components folder containing a total named child, that contains a new totalRow item as shown in the figure below.
Please let me know if you are still unable to get the Total Column
HTH,
Regards,
Syed. -
How to find the Infoset associated with a table
Which table in SAP R/3 4.6c stores the table used in Infoset.
Eg: would like to see table : MSEG used in which Infoset.
I would like to know the Joins used in Infoset
Table : AQGSCAT give only the Main table used in the Infoset.
But, I would like to know where and all MSEG is usedHi,
1. BW infoset is a join between two ODS, so, there is no table.
2. BW infoset is not the same than R/3 infoset. You won't find it in SQ02
go throgh the below the link,
http://help.sap.com/saphelp_bw33/helpdata/en/ed/084e3ce0f9fe3fe10000000a114084/content.htm
Hareesh -
How to find the view/page name in portal
Hi All,
I am new in SAP. I have to customize a Compensation page in HR module.
Could some one help me to find out these things:
--- How can I find out the page/iview name from portal which I want to customized i.e. I am on HR module of compensation page and I want to know the name of iview/page name.
--- How can I start development for customization.
Any type of help will be highly appreciated.
thanks in advance,
-AnandHi,
The component name is FITV_POWL_TRIPS. check this help for more details: https://help.sap.com/erp2005_ehp_03/helpdata/EN/46/51dd0698075e3fe10000000a11466f/frameset.htm
hope this helps u,
Regards,
Kiran
Maybe you are looking for
-
Image quality lessened in iWeb; any reason for this.
Hey everybody- Sorry if you've read this once already. I posted this in another thread of mine, but I'm afraid it will get overlooked as the question is buried within a thread that doesn't deal with this issue. So, I figured I'd start a new one in ho
-
Hello, say i have a class A that contains an object of class B. Now there's class X... It's all fine and dandy trying to compile them both until i try to set the classpath for junit, by doing: set classpath=%classpath%;C:\junit3.8.1\junit.jar i'm pre
-
The "aperture" value in EXIF from Leica M9
Hi, Aperture I'm a Leica M9 camera owner, and I found that in Apple Aperture 3, I cannot see the "aperture" value from pictures taken from Leica M9, also, the "lenses" information not available in the "Metadata" tab. I attached a screen shot of my Ap
-
screensaver wont' work after installing iTunes
-
When I updated my phone to iOS 5 it copied my photos multiple times
When I updated my phone to iOS 5 it copied them multiple times.