Sql query to find dependencies for a table
Hi All,
I am having a table (REPT_ALL) with dependent objects on it ( child tables, indexes, constraints, views, synonyms, sequences , packages,procedures,functions,triggers).
I want the query to find out all the above dependencies for the above table(REP_ALL).
I m looking for the query to find dependencies inorder to find out the risks before dropping the above table(drop table REP_ALL cascade constraints)?
Thnx
To find foreign key constraints for a table you cannot use DBA_DEPENDENCIES but you have to use DBA_CONSTRAINTS.
Example Re: Find out foreign key column
Similar Messages
-
Dynamic SQL Query to Find Special Characters in Table columns
Hi,
I am new to OTN FORUMS.
I am trying to find the columnsi of a table which have special characters in them.
I am planning on using this query
select ' select INSTR('||column_name||', chr(0))
from '||table_name||'where INSTR('||column_name||', chr(0)) >0' from user_tab_columns
where table_name='Account'
and spool the output to run as a script.
Is this the right way or do u suggest any modifications to the query?
Thanks in advance.Hi,
I think your basic approach is right. Since you can't hard-code the table- or column names into the query, you'll need dynamic SQL.
Instead SQL-from-SQL (that is, writing a pure SQL query, whose output is SQL code), you could do the whole job in PL/SQL, but I don't see any huge advantage either way.
When you say "Special character<b>s</b>", do you really mean "one given special character" (in this case, CHR(0))?
Will you ever want to search for multiple special characters at once?
What if table foo has a column bar, and in 1000 rows of foo, bar contains CHR (0). Do you want 1000 rows of output, each showing the exact position of the first CHR(0)? If the purpose is to look at theese rows later, shouldn't you include the primary key in the output? What if CHR(0) occurs 2 or more times in the same string?
If you'd rather have one row of output, that simply says that the column foo.bar sometimes contains a CHR(0), then you could do something like this:
SELECT 'foo', 'bar'
FROM dual
WHERE EXISTS (
SELECT NULL
FROM foo
WHERE INSTR ( bar
, CHR (0)
) > 0
); -
SQL Query to find dependencies
After using the Command Line Tool to add dependencies to a file, I'm now trying to query the repository for the information. I'm able to find the file and the dependency types, but i can not find the table/view that will show me what the file is actually using (ie actual table name). My query is a follows:
select c.name "container", f.name "file", t.type||' - '||t.subtype type, d.supplier_irid
from sdd_folders c
,sdd_folder_members fm
,sdd_files f
,sdd_dependencies d
,sdd_dependency_types t
where fm.parent_ivid = c.ivid
and c.name = 'C_Programs'
and fm.member_object = f.irid
and d.client_ivid = f.ivid
and t.irid = d.dependency_type_irid
and f.name = 'test.C'
Has anyone been able to query the repository for this kind of information?To find foreign key constraints for a table you cannot use DBA_DEPENDENCIES but you have to use DBA_CONSTRAINTS.
Example Re: Find out foreign key column -
Hi All,
I am looking to create a view which returns new or modified data (differences) based on a comparison between two tables.
The EMP_SOURCE table stores all employee data including duplicate staff numbers (STAFFNO):
CREATE TABLE [dbo].[EMP_SOURCE](
[FULLNAME] [varchar](255) NULL,
[JOBTITLE] [varchar](255) NULL,
[LOCATION] [varchar](255) NULL,
[COUNTRY] [varchar](255) NULL,
[STAFFNO] [varchar](255) NULL
) ON [PRIMARY]
GO
The EMP table stores unique staff numbers. This is the table used by the application.
CREATE TABLE [dbo].[EMP](
[EMP_ID] [int] NOT NULL,
[EMP_NAME] [varchar](255) NULL,
[EMP_TITLE] [varchar](255) NULL,
[EMP_OFFICE] [varchar](255) NULL,
[EMP_COUNTRY] [varchar](255) NULL,
[EMP_NUMBER] [varchar](255) NULL,
CONSTRAINT [PK_EMP] PRIMARY KEY CLUSTERED
[EMP_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
We are looking to migrate data from EMP_SOURCE to EMP but only records which are new in EMP_SOURCE and do not exist in EMP or records which are different in EMP_SOURCE from EMP.
EMP_SOURCE:
FULLNAME
JOBTITLE
LOCATION
COUNTRY
STAFFNO
John Smith
Manager
London
UK
1087
Beth King
Analyst
New York
USA
2095
Karl Bent
Manager
Chicago
USA
1106
Beth King
Junior
Washington
USA
2095
Harry Kline
Consultant
Manchester
UK
2341
EMP:
EMP_ID
EMP_NAME
EMP_TITLE
EMP_OFFICE
EMP_COUNTRY
EMP_NUMBER
1
John Smith
Manager
London
UK
1087
2
Beth King
Analyst
New York
USA
2095
3
Karl Bent
Manager
Washington
USA
1106
Based on the above comparison, EMP_SOURCE table has the following differences:
FULLNAME
JOBTITLE
LOCATION
COUNTRY
STAFFNO
Harry Kline
Consultant
Manchester
UK
2341
Karl Bent
Manager
Chicago
USA
1106
Differences in red. Beth King should be completely ignored because of duplicate staff numbers (EMP_NUMBER).
Any help to create a view which returns only the differences from EMP_SOURCE would be appreciated.
INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
VALUES (1, 'John Smith', 'Manager', 'London', 'UK', '1087');
INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
VALUES (2, 'Beth King', 'Analyst', 'New York', 'USA', '2095');
INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
VALUES (3, 'Karl Bent', 'Manager', 'Washington', 'USA', '1106');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('John Smith', 'Manager', 'London', 'UK', '1087');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('Beth King', 'Analyst', 'New York', 'USA', '2095');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('Karl Bent', 'Manager', 'Chicago', 'USA', '1106');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('Beth King', 'Junior', 'Washington', 'USA', '2095');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO) VALUES ('Harry Kline', 'Consultant', 'Manchester', 'UK', '2341');HI Manc !
You may use the below code to get your desired output;
CREATE TABLE [dbo].[EMP_SOURCE](
[FULLNAME] [varchar](255) NULL,
[JOBTITLE] [varchar](255) NULL,
[LOCATION] [varchar](255) NULL,
[COUNTRY] [varchar](255) NULL,
[STAFFNO] [varchar](255) NULL
GO
CREATE TABLE [dbo].[EMP](
[EMP_ID] [int] NOT NULL,
[EMP_NAME] [varchar](255) NULL,
[EMP_TITLE] [varchar](255) NULL,
[EMP_OFFICE] [varchar](255) NULL,
[EMP_COUNTRY] [varchar](255) NULL,
[EMP_NUMBER] [varchar](255) NULL
INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
VALUES (1, 'John Smith', 'Manager', 'London', 'UK', '1087');
INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
VALUES (2, 'Beth King', 'Analyst', 'New York', 'USA', '2095');
INSERT INTO EMP (EMP_ID, EMP_NAME, EMP_TITLE, EMP_OFFICE, EMP_COUNTRY, EMP_NUMBER)
VALUES (3, 'Karl Bent', 'Manager', 'Washington', 'USA', '1106');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('John Smith', 'Manager', 'London', 'UK', '1087');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('Beth King', 'Analyst', 'New York', 'USA', '2095');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('Karl Bent', 'Manager', 'Chicago', 'USA', '1106');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO)
VALUES ('Beth King', 'Junior', 'Washington', 'USA', '2095');
INSERT INTO EMP_SOURCE (FULLNAME, JOBTITLE, LOCATION, COUNTRY, STAFFNO) VALUES ('Harry Kline', 'Consultant', 'Manchester', 'UK', '2341');
SELECT FULLNAME,JOBTITLE,LOCATION,COUNTRY,STAFFNO FROM EMP_SOURCE
EXCEPT
SELECT EMP_NAME,EMP_TITLE,EMP_OFFICE,EMP_COUNTRY,EMP_NUMBER FROM Emp
Please let me know if this doesn’t work for you. Hope I have answered you correctly.
Thanks,
Hasham -
SQl query to find incompatibility defined
If two programs are defined as incompatible with one another, the data these programs cannot access simultaneously must also be identified.
This can be found from concurrent program->define from front end ebs login, but is there any SQL query to find this for a particular program or request set??
Thanks in advance.Please search the forum before posting similar questions.
Concurrent-Conflict
Re: Concurrent-Conflict
Thanks,
Hussein -
Sql query to find the balances for a customer account wise.
Hi,
Could someone help me with the sql query to find the balances for each customer account wise. This is need to generate the report.
presently we are using this query, but the output doesnot return the expected result.
SELECT sum(nvl(ps.acctd_amount_due_remaining,0)) "Balance"
FROM ra_cust_trx_line_gl_dist_all gld,
gl_code_combinations c,
ar_payment_schedules_all ps,
RA_CUSTOMER_TRX_ALL rat,
ra_customers rc
WHERE c.CHART_OF_ACCOUNTS_ID = 101
and gld.code_combination_id = c.code_combination_id
and rat.CUSTOMER_TRX_ID=gld.CUSTOMER_TRX_ID
and rat.CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
and ps.customer_id=rc.customer_id
and ps.status='OP'
and ps.gl_date <= :PDATE
and ps.org_id=:PORGID
and ps.class in ('GUAR','INV','DM','DEP')
and c.SEGMENT4=:Account_id
and ps.customer_id=:Customer_id
Thanks in advance.
Kalyan.Can someone help us with this.
-
IDM with SQL server Error: Cannot find columns for the table...
Hi all,
I am Configuring IDM with SQL Server repository and ran into this error.
'Cannot find columns for the table 'object'
.....jdbc...[SQL Server]Invalid object name 'object'
Can anybody please help me!!
GYes, permissions are very important. I ran into a similar problem because I didn't have the correct permissions. Make sure the user has the following permissions:
CREATE ANY TABLE
ALTER ANY TABLE
DROP ANY TABLE
CREATE ANY PROCEDURE
EXECUTE ANY PROCEDURE
DROP ANY PROCEDURE
Also, make sure there is enough space in the default tablespace of that user.
HTH
~Suvesh -
Sql query to find all contacts for an account
I wonder if someone wrote an sql query to find all contacts for an account number in Oracle customer master. We are on EBS 11.5.10.
I am also looking for sql query to find all ship to addresses for an account number.
Thanks.Can you also post the query for people who read this post and are also looking for an answer?
Regards,
Johan Louwers. -
SQL query to find out last login for each database
Hi everybody,
I have a view with following columns:
DatabaseSid, lastLogin, firstLogin.
I want to now the newest last_login date for every database.
SID First Login Last Login
e.g. Database1, 11.11.2011, 01.12.2011
Database1, 01.04.2012, 01.05.2012
Database3, 03.03.2004, 03.06.2005
Database 3 07.09.2012, 12.10.2012
How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
Thank you in advance
SteveSteve wrote:
Hi everybody,
I have a view with following columns:
DatabaseSid, lastLogin, firstLogin.
I want to now the newest last_login date for every database.
SID First Login Last Login
e.g. Database1, 11.11.2011, 01.12.2011
Database1, 01.04.2012, 01.05.2012
Database3, 03.03.2004, 03.06.2005
Database 3 07.09.2012, 12.10.2012
How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
Thank you in advance
SteveI'm curious as to how you collect this information from multiple databases into one database, and of what value the data is once you have it. -
Looking at dependencies for a table gets Error ORA-01436: CONNECT BY loop
I have just tried looking at the dependencies for a table and I received an "ORA-01436: CONNECT BY loop in user data.
Please let me know if there are any fixes or work arounds for this problem.
Thanks
SunilLooks like there is another posting on this.
ORA-01436 in Dependencies
Because the query uses CONNECT BY and there is a circular reference it errors out. If it didn't, there would be an infinite number of results.
This is the query that Oracle is using: SELECT owner, object_type, object_name, object_id, status , decode(replace(object_type,' ','_'),'PACKAGE_BODY','PACKAGE',replace(object_type,' ','_')) type_link
FROM sys.all_objects
WHERE object_id IN (
SELECT object_id
FROM public_dependency
CONNECT BY PRIOR object_id = referenced_object_id
START WITH referenced_object_id = :OBJECT_ID ) pulled from sql_dev_root/jdev/extensions/oracle.dbdev.oviewer.jar, editors.xml
I am not a connect by pro, so I can't tell you how to alter this to make it stop digging when it encounters an infinite loop, but maybe someone else can. In other tools, it normally dynamically pulls this data into a tree so it is only querying one level at a time.
This happens if for example MY_TABLE depends upon MY_PACKAGE and vice versa:
--MY_TABLE
--MY_PACKAGE
--MY_TABLE
--MY_PACKAGE
.... Hopefully someone on the sql dev team has a solution to this and can get it fixed in a later release. -
SQL Query to find menus and submenus attached to responsibility
Hi,
I am looking for help to find out a sql query to pull out the list of all the menu's associated with each of the responsibilities assigned to users. Please let me know any SQL query to find out menus attached for responsibilities assigned to users.835129 wrote:
I was asked by my lead to list out responsibilities and attached menus and I was asked to submit the output from production. In the metalink note provided by you it was asked to create table collecting all menu id's and I cannot create any tables in production. Apart from this there were 1000's of users with different responsibilities and different menus. I cannot collect all of the users menu ids.
I just want to list out responsibilities and attached menus. Is that something you can helpout withhttps://forums.oracle.com/forums/search.jspa?threadID=&q=fnd_responsibility_vl+AND+fnd_menu&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
https://forums.oracle.com/forums/search.jspa?threadID=&q=fnd_responsibility_tl+AND+FND_MENU_ENTRIES_TL&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Please search the forum for these tables/views and you should get many hits:
FND_MENU_ENTRIES_TL
FND_MENU_ENTRIES_VL
FND_RESPONSIBILITY_TL
FND_RESPONSIBILITY_VL
Thanks,
Hussein -
SQL Query to Find out User has what all resources provisioned !
Hi Guys ,
Does any one have a SQL query to find out what resources are provisioned to a particular user ?
Thanks
SurenHi,
Hope this will help you.
SELECT distinct usr_login as "IdM User ID",
usr_employeeID as "Employee ID",
usr.USR_FIRST_NAME as "First Name",
usr.USR_LAST_NAME as "Last Name",
usr_status
as "User Status",
USR_EMP_TYPE as "Employee Type",
obj.obj_name as "Application Resource",
ost_status as "Application Resource Status",
FROM ost,oiu,obj,usr,obi
WHERE oiu.ost_key = ost.ost_key AND obj.obj_key = obi.obj_key AND oiu.usr_key = usr.usr_key
AND ost_status in ('Provisioned','Revoked','Disabled', 'Provisioning')
AND oiu.obi_key=obi.obi_key
AND usr_EmployeeID like '11111'
This query will provide all the resources to which the user is linked with and the resource status is in 'Provisioned','Revoked','Disabled', 'Provisioning' status for a particular employeed ID, I am not completely sure whether I have given the Employee ID column from USR table as correct or not. Verify once and query the DB -
Can anybody provide the SQL query to find the files uploaded in a particular folder?
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
NevinNevin,
Be great if we could know the version of Portal. For Rel. 1, here's the query
select id,masterthingid from wwv_things
where siteid = &site
and cornerid = &corner
&site - Content Area id
&corner - Folder id
if you don't know the folder id, use
select id from wwv_corners where siteid = &site
and name = &folder
Hope this helps. I have run into this situation before. Usually, the culprits were
one of the following:
1. Junk Characters in description of item (caused due to Copy-Paste)
2. Special Characters in the File name
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
Nevin -
SQL query to find sqlnet.ora parameters
Hi All,
I am working 11g RAC /solaris 9
I want have sql query to find values of sqlnet.ora parameters
May be values of SQLNET.INBOUND_CONNECT_TIMEOUT
SQLNET.SEND_TIMEOUT, SQLNET.RECV_TIMEOUT
Thanks
rajThe sqlnet.ora file is the profile configuration file. It resides on the client machines and the database server.
Profiles are stored and implemented using this file. The database server can be configured with access control parameters in the sqlnet.ora file.
These parameters specify whether clients are allowed or denied access based on the protocol.
The sqlnet.ora file enables you to do the following:
Specify the client domain to append to unqualified names
Prioritize naming methods
Enable logging and tracing features
Route connections through specific processes
Configure parameters for external naming
Configure Oracle Advanced Security
Use protocol-specific parameters to restrict access to the database
By default, the sqlnet.ora file is located in the ORACLE_HOME/network/admin directory. The sqlnet.ora file can also be stored in the directory specified by the TNS_ADMIN environment variable.
You can not query on this file sqlnet.ora as tnsnames.ora file.
Regards
Mahir M. Quluzade -
SQL query to find access database files?
Odd request, but does anyone have a SQL query to find files? Specifically, I am looking for machines that have access databases on them. .mdb & .accdb
Have you enabled inventory for them?
Garth Jones | My blogs: Enhansoft and
Old Blog site | Twitter:
@GarthMJ
i was trying to figure out where that option was but couldn't find it under hierarchy settings. perhaps it's been changed since 2012 R2? can you help point it out?
Maybe you are looking for
-
HI All, Please any body provide me code for uploading vendor details using XK02 with some fileds. regards Bhaskar
-
Exception Message Numner in transaction MD04
Hello, There is a field Exception Message Number on screen of transaction MD04. On my report i need to display the exception message number for corresponding MRP data element. Which tables do i need to access and the flow? regards Nishant PS : points
-
Don't ask how I lost it! :-/ I followed instructions for re-instillation using Pacifist but after using Pacifist and searching for QuicktimePlayer.App all I find is a log file, no way of re-installing. David Brewer gave great instructions and followi
-
Problems installing SunScreen 3.2
When trying to install SunScreen, after using ssadm Configure I'm getting the following output: --Adding interfaces & interface addresses* --Initialize 'vars' databases* --Initialize 'authuser' & 'proxyuser' databases* --Initialize 'logmacro' databas
-
Leopard crashes upon Insertion of USF 1.02 formatted Disk
Hi Folks, Here is the latest issue – OS X crashed last night on my macbook. Reason – Infra Recorder is an open source utility to burn disks fast in windows – it burns in UDF 1.02 format. Vista peacefully recognizes and plays – on mac – upon insertion