SQL Query to return all the dependent objects
Hi,
I have a question.
Suppose I am creating a table with a join on 10 other tables, views etc..
And there are nested sub-queries in the CREATE statement.
How can I get the list of all the dependent objects for that table without counting them manually.
I know, we can right click the table/view name and check the dependent objects in Toad or SQL Developer.
But, I want to know the SQL query for getting that information.
Thanks
Rajiv
well there is no way oracle would know what query was used when the table was created.
But here is one intuitive trick:
Step 1: Create a procedure that will have a cursor declared on the query you want to know what tables/views are used.
Step 2: Check USER_DEPENDENCIES to see what objects this procedure depends on
Let say you want to create TEST_A table using the following statement:
create table test_a
as
select *
from scott.emp,
scott.dept;
1 create or replace procedure test_temp
2 as
3 cursor test_cur is
4 select *
5 from scott.emp,
6 scott.dept;
7 begin
8 null;
9* end;
SQL> /
Procedure created.
SQL> show errors
No errors.
SQL> desc user_dependencies
Name Null? Type
NAME NOT NULL VARCHAR2(30)
TYPE VARCHAR2(17)
REFERENCED_OWNER VARCHAR2(30)
REFERENCED_NAME VARCHAR2(64)
REFERENCED_TYPE VARCHAR2(17)
REFERENCED_LINK_NAME VARCHAR2(128)
SCHEMAID NUMBER
DEPENDENCY_TYPE VARCHAR2(4)
SQL> select referenced_owner, referenced_name, referenced_type
2 from user_dependencies
3 where name='TEST_TEMP' and referenced_owner<>'SYS';
REFERENCED_OWNER
REFERENCED_NAME
REFERENCED_TYPE
SCOTT
DEPT
TABLE
SCOTT
EMP
TABLE
SQL>
SQL> drop procedure test_temp;
Procedure dropped.
SQL>Message was edited by:
tekicora
Message was edited by:
tekicora
Similar Messages
-
SQL query which return all the NET SERVICES which are avaiable in tnsname
hi all
how to write a sql query which return all the net services which are avaiable in tnsname.ora
Regards
sAlso, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
Regards Nigel -
Sql query to identify all the responsibilities attached to a form
(oracle - apps) Can anyone help me by giving a sql query to identify all the responsibilities attached to a form and corresponding menu should not be in the menu exclusion.
Thanks in advance
VenkiBump
-
SQL query to find all the custom folders in Discoverer (query posted)
I know its not a question I am posting..this is just to inform community users that this query makes life easier in case someone wants to find out all the custom folders in a particular EUL (folder name starting with XX)
select b.ba_name,f.obj_name folder_name,f.obj_id,f.obj_ext_owner Owner
from
APPS.EUL5_objs f
, APPS.EUL5_ba_obj_links l
, APPS.EUL5_bas b
where 1=1
and f.obj_id= l.bol_obj_id
and b.ba_id= l.bol_ba_id
and b.ba_name like 'XX%'
order by b.ba_name,f.obj_name;
Hopefully it would be useful to others!Connect as sysdba and try..
To list all objects >100M in size.
SQL> select owner, segment_type, segment_name, sum(bytes)/(1024*1021) from dba_segments
group by owner, segment_type, segment_name
having sum(bytes)/(1024*1021) > 100
For tablespaces ..
select tablespace_name, sum(bytes) tablespace_size
from dba_data_files
group by tablespace_name
union all
select tablespace_name, sum(bytes) tablespace_size
from dba_temp_files
group by tablespace_name
order by tablespace_name -
Looking for a SQL query to get all the possible Alert Messages from the Rules in a Management Pack
For reporting, I'm looking to get a SQL query of all the possible Alert Messages for Rules configured in a Management Pack (not necessarily the ones that have thrown alerts). I can do this for Monitors, but not for Rules.
The configured alert messages for the Management Pack Monitors
go like this: ManagementPack > MonitorView> RuleModule > RuleModule.Alert Message > Localized Text
The configured alert messages for the Management Pack Rules
should go something like this, but there is a missing link: ManagementPack > RuleView > RuleModule > ? Missing Link ? > Localized Text
The Rules are tied to the Module, but I don't see a connection from the RulesModule to the Alert Message that I see in the LocalizedText. The Rule names do not always equal the Alert name.
Can someone provide the missing link?Hi,
please try below powershell code to find the corresponding management pack for specific alert:
$Alert = get-scomalert | where {$_.Name -like 'Agent Proxy Not Enabled*'} | select -first 1
If ($alert.IsMonitorAlert -eq "True") {
write-host "Ths is a monitor-generated alert"
get-scommonitor -ID $Alert.MonitoringRuleID | select Enabled, DisplayName, ManagementPack
else
write-host "This is a rule-generated alert"
get-scomrule -ID $Alert.MonitoringRuleID | select Enabled, DisplayName, ManagementPack
In addition, please also refer to the below link:
http://blogs.technet.com/b/mazenahmed/archive/2011/12/02/using-powershell-to-map-opsmgr-active-alert-to-its-corresponding-rule-monitor-and-management-pack-name.aspx
Regards,
Yan Li
Regards, Yan Li -
Need a query to list all the personalized objects under a given path
Hello Gurus,
Can you help me with a query that will give me a list of all personalized objects that are under a given path like /oracle/apps/per/...
Thanks,
VinodHi Vinod,
You can get the details from Functional Administrator responsibility, personalization tab, enter the "Document Path" like /oracle/apps/per
and check the "Personalized" checkbox. And you can import the personalization to the file system also. More details check the Note
The query
begin
jdr_utils.listcustomizations('/oracle/apps/pon/award/completion/webui/ponCompleteAward2PG');
end;
Will give the details for only one page.
Thanks.
With Regards,
Kali.
OSSi. -
SQL Query to search all the tables for a given string
Hi all,
This is concerning a query to search each and every table/column for a given string.
I came across a similar post (Re: question about searching 600 tables and this query seems to be inline with my requirements:
select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('MY_TABLE')
However, I am getting the following error:
ORA-24451: OCIKCallPushTrusted, Maximum call depth exceeded
I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit and could you please let me know the best possible way to accomplish this task?
Thanks.
Edited by: itech.quest on Sep 19, 2010 8:30 AMHi Tamir,
Thanks so far. I am yet to make the crucial breakthrough as far my application goes. Are you talking about the EUL5_QPP_STATS table? I tried retrieving worksheets even from that table also with the following query
SELECT DISTINCT Eul5QppStats.QS_DOC_NAME,Eul5QppStats.QS_DOC_DETAILS
FROM EUL5_QPP_STATS Eul5QppStats,EUL5_DOCUMENTS Eul5Documents
WHERE Eul5QppStats.QS_DOC_NAME = Eul5Documents.DOC_NAME
However, the worksheet data retrieved by Discoverer Oracle's product is not matching my dataset for every workbook. Please suggest.
Reg
Thomas -
SQL query problem, listing all deliveries linked to an invoice
Hi I'm trying to write a query that returns all the deliveries linked to an invoice as a single commaseparated result.
This query gets all the links from every line as a commaseparated result but I want to remove the duplicate entries, eg. where/how do I insert the distinct clause?
DECLARE @EmployeeList varchar(350)
SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') +
( T1.baseref )
FROM oinv T0 inner join inv1 T1 on T0.DocEntry = T1.DocEntry
where T0.docnum = 119229 and T1.baseref <> ''
SELECT @EmployeeList
Thanks in advance for all helpHi,
How did you use the temporary table?
Can you write your code here.
I am also getting repeated data values in my query output. I want to save that query output into one temporary table and than want to use the SELECT DISTINCT on that temporary table. I am searching on forum madely to do that but can't find the perfect help. It will be nice if you can help me in that.
Thank you -
Contains return all the records when the query string matches the columns
I used the multi_column_datastore preference and created an index on three columns (item_name, description,owner_part_number). Now if I do a search:
select * from items where contains(description, 'description') > 0;It returns all the rows in items table, but not all the rows have "description" as a word. I guess Oracle text assumes the query intends to get all the rows as the query string matches one of the column names. My question is whether Oracle Text has any preference settings to alter this behavior?
execute ctx_ddl.create_preference('item_multi_preference', 'MULTI_COLUMN_DATASTORE');
execute ctx_ddl.set_attribute('item_multi_preference', 'columns', 'item_name, description,owner_part_number');
create index item_text_index on items(description) indextype is ctxsys.context filter by owner parameters('LEXER ENG_LEXER WORDLIST ENG_WORDLIST STOPLIST CTXSYS.EMPTY_STOPLIST datastore item_multi_preference MEMORY 1024M');Thanks.
Jun GaoIt looks like a basic_section_group fixes the problem as well, as demonstrated below and I believe a basic_section_group may be more efficient than auto_section_group.
SCOTT@orcl_11gR2> -- recreation of problem:
SCOTT@orcl_11gR2> drop table items
2 /
Table dropped.
SCOTT@orcl_11gR2> create table items (
2 "ITEM_NAME" varchar2(100 byte),
3 "ITEM_NUMBER" varchar2(100 byte),
4 "DESCRIPTION" varchar2(4000 byte),
5 "OWNER" number
6 )
7 /
Table created.
SCOTT@orcl_11gR2> begin
2 FOR Lcntr IN 1..100
3 loop
4 insert into items (item_name, item_number, description, owner)
5 values (dbms_random.string('A', 10),
6 dbms_random.string('A', 10),
7 dbms_random.string('L', 8) || ' '
8 || dbms_random.string('A', 4)
9 || dbms_random.string('A', 5) || ' '
10 || dbms_random.string('A', 10),
11 dbms_random.value(1,10) );
12 end loop;
13 end;
14 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 FOR Lcntr IN 1..100
3 loop
4 insert into items (item_name, item_number, description, owner)
5 values (dbms_random.string('A', 10),
6 dbms_random.string('A', 10),
7 dbms_random.string('L', 8) || ' '
8 || dbms_random.string('A', 4) || '111'
9 || dbms_random.string('A', 5) || ' '
10 || dbms_random.string('A', 10), 1234 );
11 end loop;
12 end;
13 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> exec ctx_ddl.drop_preference('ENG_WORDLIST');
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference('ENG_WORDLIST', 'BASIC_WORDLIST');
3 ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_INDEX','TRUE');
4 ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_MIN_LENGTH',1);
5 ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_MAX_LENGTH',10);
6 ctx_ddl.set_attribute('ENG_WORDLIST','SUBSTRING_INDEX','TRUE');
7 ctx_ddl.set_attribute('ENG_WORDLIST','WILDCARD_MAXTERMS', 0);
8 end;
9 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> execute ctx_ddl.drop_preference('ENG_LEXER');
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 CTX_DDL.CREATE_PREFERENCE ('ENG_LEXER', 'BASIC_LEXER');
3 CTX_DDL.SET_ATTRIBUTE ('ENG_LEXER', 'PRINTJOINS', '@-_');
4 end;
5 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> execute ctx_ddl.drop_preference('items_multi_preference');
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference('items_multi_preference', 'MULTI_COLUMN_DATASTORE');
3 ctx_ddl.set_attribute('items_multi_preference', 'columns', 'item_name, description,item_number');
4 end;
5 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> create index items_text_index
2 on items(description)
3 indextype is ctxsys.context
4 parameters
5 ('LEXER ENG_LEXER
6 WORDLIST ENG_WORDLIST
7 STOPLIST CTXSYS.EMPTY_STOPLIST
8 datastore items_multi_preference
9 MEMORY 1024M')
10 /
Index created.
SCOTT@orcl_11gR2> create index owner_idx on items (owner)
2 /
Index created.
SCOTT@orcl_11gR2> exec dbms_stats.gather_table_stats (user, 'ITEMS')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> select count(*)
2 from items
3 where contains (description, 'description') > 0
4 /
COUNT(*)
200
1 row selected.
SCOTT@orcl_11gR2> -- correction of problem:
SCOTT@orcl_11gR2> exec ctx_ddl.drop_section_group ('items_sec')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_section_group ('items_sec', 'basic_section_group');
3 ctx_ddl.add_field_section ('items_sec', 'item_name', 'item_name', true);
4 ctx_ddl.add_field_section ('items_sec', 'description', 'description', true);
5 end;
6 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> drop index items_text_index
2 /
Index dropped.
SCOTT@orcl_11gR2> create index items_text_index
2 on items(description)
3 indextype is ctxsys.context
4 parameters
5 ('LEXER ENG_LEXER
6 WORDLIST ENG_WORDLIST
7 STOPLIST CTXSYS.EMPTY_STOPLIST
8 datastore items_multi_preference
9 MEMORY 1024M
10 section group items_sec')
11 /
Index created.
SCOTT@orcl_11gR2> select count(*)
2 from items
3 where contains (description, 'description') > 0
4 /
COUNT(*)
0
1 row selected. -
Reg: sql query that prints all sundays in the year
Hi all,
Please give me sql query that prints all sundays in year. And when ever we execute that query then that will prints the sysdate(that is execution date).
Thanks in Advance,
-prasad.
Edited by: prasad_orcl on Jun 5, 2009 9:13 PMHi,
Plz try this and let me know this works or not...
SELECT DATE DATES,TO_CHAR(DATE,'DAY') DAYS FROM FISCAL_CALENDAR
WHERE DATE_YEAR = 2009 AND
DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND
ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12) -1 AND
TRIM(TO_CHAR(DATE,'DAY')) = 'SUNDAY'
ORDER BY DATE
OUTPUT:
DATES DAYS
1/4/2009 SUNDAY
1/11/2009 SUNDAY
1/18/2009 SUNDAY
1/25/2009 SUNDAY
2/1/2009 SUNDAY
2/8/2009 SUNDAY
2/15/2009 SUNDAY
2/22/2009 SUNDAY
3/1/2009 SUNDAY
3/8/2009 SUNDAY
3/15/2009 SUNDAY
3/22/2009 SUNDAY
3/29/2009 SUNDAY
4/5/2009 SUNDAY
4/12/2009 SUNDAY
4/19/2009 SUNDAY
4/26/2009 SUNDAY
5/3/2009 SUNDAY
5/10/2009 SUNDAY
5/17/2009 SUNDAY
5/24/2009 SUNDAY
5/31/2009 SUNDAY
6/7/2009 SUNDAY
6/14/2009 SUNDAY
6/21/2009 SUNDAY
6/28/2009 SUNDAY
7/5/2009 SUNDAY
7/12/2009 SUNDAY
7/19/2009 SUNDAY
7/26/2009 SUNDAY
8/2/2009 SUNDAY
8/9/2009 SUNDAY
8/16/2009 SUNDAY
8/23/2009 SUNDAY
8/30/2009 SUNDAY
9/6/2009 SUNDAY
9/13/2009 SUNDAY
9/20/2009 SUNDAY
9/27/2009 SUNDAY
10/4/2009 SUNDAY
10/11/2009SUNDAY
10/18/2009SUNDAY
10/25/2009SUNDAY
11/1/2009 SUNDAY
11/8/2009 SUNDAY
11/15/2009SUNDAY
11/22/2009SUNDAY
11/29/2009SUNDAY
12/6/2009 SUNDAY
12/13/2009SUNDAY
12/20/2009SUNDAY
12/27/2009SUNDAY
Regards
Thiyag -
Need to find the dependent object details for an object.
Hi,
Is there any query to find the dependent object details for any object. Like if mview is built on a table, then i should be able to find the table name with out checking code of the mview. Thanks in-advance for your support. similar way for view and functions or procedures etc...
Regards
DBA.Hi all,
Thanks a lot for your inputs. seems i have not given full details in my post. I need to have a SQL Query to find the dependent object details not DDL.
if i give a metriealized view name, i should get the base table names directly not DDLs...
if i give index name i should get its corresponding table name(off course i got this already)...
if i give a function name, i should get all the tables which are being in the function...etc...
i am looking for a script which will cover all the aspects.....i hope i have given now enough information for this....
Regards
DBA. -
SQL- Query that return only one record
Hello,
is it possible to execute a pure SQL-Query which returns only one row although multiple rows are found.
It is no problem in PL/SQL, but I have no idea if the same is also possible in SQL.
thanks in advance
MichaelWhy not? There are 4 records in this table, but only selected one.
SQL> with t
2 as
3 (
4 select '#%$@#$@$@##$' Addr from dual
5 union all
6 select '18 Jalan Scott' from dual
7 union all
8 select '18 Lemana St' from dual
9 union all
10 select '32-penstation' from dual
11 union all
12 select '99999999999' from dual
13 )
14 select addr
15 from t
16 where rownum =1
17 /
ADDR
#%$@#$@$@##$
SQL>Cheers
Sarma. -
How to generate the DDL script of all the schema objects.
Hi All,
I just wanted to make centralized repository for Oracle database and to create a base version, I need to create the DDL scripts of all the database objects so that i can check in the same ddl scripts (sql) files in to my central repository.
I need do this schedule job which will generate the ddl scripts once in a month(This should be automated process)
Please help me out about this.
Oracle version - 9i
Thanks in advance.
Thanks,
Santosh
Edited by: Santosh_Oracle on Feb 23, 2011 10:26 PMIt is definitely possible to revise the script.
Look at it, you already have 80 percent of it for free, and you didn't even need to Google.
Just ask a FAQ in a forum loaded with FAQs!
And Toad can save everything to one script per object.
Sybrand Bakker
Senior Oracle DBA -
RowSetIterator not returning all the rows
Hi,
We have a use-case where we need to create a new row iterator to insert rows(values) in it. Immediately after insertRow(), we are reading the values by creating a secondary row set iterator (createRowSetIterator) but it is not returning all the inserted rows. Here is the code snippet:
Code to insert rows:
public void insertTerrLineOfBusiness(CreateOperation operation, TerritoryVORowImpl newTerritoryRow, TerritoryVORowImpl selectedRow){
if((operation.equals(CreateOperation.CREATE))
|| operation.equals(CreateOperation.COPY)
|| operation.equals(CreateOperation.ADD_EXISTING)){
RowIterator selTerritoryLineOfBusinessIter = selectedRow.getTerritoryLineOfBusiness();
//RowIterator newTerrLineOfBusinessIter = newTerritoryRow.getTerritoryLineOfBusiness();
ViewRowSetImpl newTerrLineOfBusinessIter = (ViewRowSetImpl) newTerritoryRow.getTerritoryLineOfBusiness();
newTerrLineOfBusinessIter.setAssociationConsistent(true);
while(selTerritoryLineOfBusinessIter.hasNext()){
TerritoryLineOfBusinessVORowImpl selTerrLineOfBusinessRow =
(TerritoryLineOfBusinessVORowImpl)selTerritoryLineOfBusinessIter.next();
TerritoryLineOfBusinessVORowImpl newTerrLineOfBusinessRow =
(TerritoryLineOfBusinessVORowImpl)newTerrLineOfBusinessIter.createRow();
newTerrLineOfBusinessRow.setTerritoryVersionId(newTerritoryRow.getTerritoryVersionId());
newTerrLineOfBusinessRow.setLobCode(selTerrLineOfBusinessRow.getLobCode());
newTerrLineOfBusinessIter.insertRow(newTerrLineOfBusinessRow);
Code to read:
public List getTerritoryLobsValues() {
List <String> lobsValues = new ArrayList<String>();
if (this.getTerritory().getCurrentRow() != null) {
TerritoryVORowImpl territoryVORowImpl =
(TerritoryVORowImpl)this.getTerritory().getCurrentRow();
if(territoryVORowImpl.getTerritoryLineOfBusiness() != null){
ViewRowSetImpl territoryLob =
(ViewRowSetImpl)territoryVORowImpl.getTerritoryLineOfBusiness();
RowSetIterator itr = territoryLob.createRowSetIterator(null);
if(itr!=null){
while(itr.hasNext()) {
Row r = itr.next();
String lobCode = (String)r.getAttribute("LobCode");
lobsValues.add(lobCode);
itr.closeRowSetIterator();
return lobsValues;
Can anybody suggest what could be the issue? How to fix it?
Thanks,
AkhilaThanks for your response.
Jdev version:
Primary == FUSIONAPPS_PT.V1REL6INT_LINUX.X64_120719.0800 (Primary Product for the view)
Primary depends on FMWTOOLS == FMWTOOLS_11.1.1.6.0_GENERIC_120112.0037.2
FMWTOOLS depends on label == JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192.1
The above label originated from base label == JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192
Use case: We have a tree table, each record may or may not have Line of Business(LOB) associated with it. On creating a child node in the tree table, the child node copies all the attributes of parent. These attributes are not committed explicitly, if user wants to save the child node only then the attributes are committed.
Giving secondary rowSetIterator a name did not help in resolving this issue.
If I am calling postChanges() before reading from secondary row iterator then its returning all the inserted values. But this.getTransaction().postChanges() is a JAudit violation, so cannot use it:
RuleId: apps-jbo-category.File.AdfModel.54
Rule: insertTerrLineOfBusiness - Review DBTransaction.postChanges call to ensure passivation-safety
Any pointers on this? -
Need UCM service which has to return all the files in the Folder
HI,
I need a webservice which has to return all the images/text files in the folder. I ll pass folder name has a input parameter..once i got all the files i have to shown those images in the web page.
Do we have any service with this requirement?? Or
i have to use 'Seach' service ,Which has return all the files meta info ...with this info do i have to use GetFile service for displaying data??
Any suggestions??
ThanksHi Jiri,
I dont know abt folios..I ll go thru it now..
When coming to the option a)
When we are calling Search service it will return resultset which contains meta data(Filename,File Id,URL,etc.....) for list of files in the folder. Now what i do to display image is , using this URL i ll bulid image object using this URL and i ll display it on the webpage(This web page contains Silver light component to display these images.)
I m assuming problem with this one is every time when i m building image i m hitting the the server to construct the image. Instead im trying to get the all the images in one shot when i pass folder name??
I doubt myself wether my assumtion is correct or not...
any suggestions plz..
Thanks
Maybe you are looking for
-
my slides are all mixed up after i imported them into a new slideshow. i just copied them from the events and dragged the icon to the new slideshow but the have re arranged themselves into a random order. I want them to play in the order i took them
-
Thread Pool "Null Pointer" exception
Hello, I have an embarrassingly parallel algorithm. The parallel part is solved by 2 objects called shifters which implement the Runnable interface. However, for reasons I can't figure out, sometimes my code will randomly output this error. Exception
-
Can anyone explain me the short code given here...
Hi... Below is given a code and its output is Hi from 1. Can anyone provide me an explanation for this... ie why the "String a" method is called and not "Object a". public class Test { public static Object a(Object two) System.out.println("Hi from 2"
-
JAXB 2.0 on eclipse : the chosen operation is not currently available
Hi. I have downloaded the JAXB2.0 plug-in, unzipped it into the plugin directory of my Eclipse, started Eclipse. I right-click on a .xsd file and get JAXB2.->Run XJC, but then I get "The chosen operation is not currently available. In Eclipse error l
-
i wanna know why or how i can get it working in leopard.