Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

System Tables in Oracle 10g Expand / Collapse
Author
Message
Posted Friday, October 08, 2010 8:26 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:41 PM
Points: 22,491, Visits: 30,185
We all know that in SQL Server that there is a system table that tells you about all the columns in each table in a database, sys.columns (in SQL Server 2005/2008).

Is there an equivalent system table or view that provides the same information? I'm not having much luck finding one, but perhaps one of you out there that also are familiar with Oracle may be able to assist.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1001343
Posted Friday, October 08, 2010 8:54 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:24 AM
Points: 12,744, Visits: 31,069
there's a few suites of views of the objects: ALL_TABLES, DBA_TABLES and USER_TABLES;

i try to stick with USER_tables, which are filtered to the schema you belong to (well the oracle user)
USER_TABLES is ~sys.tables
user_tab_columns is ~ sys.columns

here's an example i use when getting tables in a FK hierarchy order:
WITH MyCommonTableExpression
AS
(
SELECT
a.table_name as child_table,
b.table_name parent_table,
colb.column_name as child_column

from user_constraints a
INNER JOIN user_constraints b ON a.r_constraint_name = b.constraint_name
INNER JOIN user_cons_columns conb ON conb.constraint_name = b.constraint_name
INNER JOIN user_tab_columns colb ON colb.table_name = conb.table_name
AND colb.column_name = conb.column_name
WHERE a.constraint_type = 'R'

)
SELECT
parent_table,
child_table,
child_column,
1 as lvl
FROM MyCommonTableExpression
WHERE parent_table='GMACT'
START WITH parent_table = 'GMACT'
CONNECT BY PRIOR child_table = parent_table



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1001371
Posted Friday, October 08, 2010 9:04 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:24 AM
Points: 12,744, Visits: 31,069
also this will really get you what you are after:
select * from all_views where LEFT(view_name,5) = 'USER_'



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1001384
Posted Friday, October 08, 2010 11:16 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:41 PM
Points: 22,491, Visits: 30,185
I also founf ALL_TAB_COLUMNS that provided me with the info I needed.

I will definately take a closer look and the code you provided when I have a little more time. Got some project stuff I need to work on right now.

Thanks Lowell.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1001458
Posted Monday, October 11, 2010 8:57 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 8:15 AM
Points: 3,068, Visits: 4,639
Lynn Pettis (10/8/2010)
We all know that in SQL Server that there is a system table that tells you about all the columns in each table in a database, sys.columns (in SQL Server 2005/2008).

Is there an equivalent system table or view that provides the same information? I'm not having much luck finding one, but perhaps one of you out there that also are familiar with Oracle may be able to assist.

check dba_tab_columns, you have to have dba privileges to have access to it.


_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #1002233
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse