Created
June 21, 2013 17:11
-
-
Save nastanford/5832732 to your computer and use it in GitHub Desktop.
Oracle - List Tables and Columns for each table for an Owner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<basefont face="arial" /> | |
<CFSET REQUEST.DSN = "yourdatasource" /> | |
<CFSET REQUEST.OWNER = "owner" /> | |
<CFQUERY NAME="tables" Datasource="#REQUEST.DSN#" > | |
SELECT table_name | |
FROM all_tables | |
WHERE owner = '#REQUEST.OWNER#' | |
ORDER BY TABLE_NAME | |
</CFQUERY> | |
<cfset tablelist = ""/> | |
<cfoutput query="tables"> | |
<cfset tablelist = listAppend(tablelist,#tables.table_name#) /> | |
</cfoutput> | |
<cfoutput> | |
<cfloop list="#tablelist#" index="item"> | |
<hr /><b>#item#</b><br /><hr /> | |
<cfquery name="columns" datasource="#REQUEST.DSN#" maxrows="1"> | |
SELECT * FROM #item# | |
</cfquery> | |
<cfloop list="#columns.columnlist#" index="itemcolumn" > | |
#itemcolumn#<br /> | |
</cfloop> | |
</cfloop> | |
</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment