Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2005

Tip: Looking for answers? Try searching our database.

check if columns exist in a table

Thread view: 
laredotornado@zipmail.com - 25 Jan 2005 19:39 GMT
Is there a way I can write a query to check if columns A, B, and C only
exist in table T?  If table T contains columns A, B, C, and D then I
want the query to  fail or return some appropriate result.  I am using
JDBC so if the query throws an error, that will let me know there the
table that deoes not contain the specified columns.

I am using Oracle 8.1.7 for Solaris and JDK 1.3.
Thanks for the advice, - Dave
nioTo - 25 Jan 2005 21:12 GMT
Le 25/01/2005 20:39, laredotornado@zipmail.com a écrit :
> Is there a way I can write a query to check if columns A, B, and C only
> exist in table T?  If table T contains columns A, B, C, and D then I
[quoted text clipped - 4 lines]
> I am using Oracle 8.1.7 for Solaris and JDK 1.3.
> Thanks for the advice, - Dave

the best way to check columns is to use the method getColumns( ... )
of class java.sql.DatabaseMetaData

nioTo
Thomas Kellerer - 25 Jan 2005 21:20 GMT
laredotornado@zipmail.com wrote on 25.01.2005 20:39:
> Is there a way I can write a query to check if columns A, B, and C only
> exist in table T?  If table T contains columns A, B, C, and D then I
[quoted text clipped - 4 lines]
> I am using Oracle 8.1.7 for Solaris and JDK 1.3.
> Thanks for the advice, - Dave

<http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getColumn
s(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String
)>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.