Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Determine if a column exists...
Hello,
Is there a SQL command in ORACLE (10g) that checks if a table column exists?
I have over 700 tables of which some have columns that I want to
rename, and some
of the tables don't have the same columns.
I have a script to do this but it fails if a table doesn't contain the
column I'm
trying to alter (ORA-00904). I would like to check if the column
exists before
executing the alter statement so the script won't abort.
Something like:
IF EXISTS(tablename.column_name)
ALTER TABLE tablename RENAME COLUMN column_name TO new_column_name
Thanks
Jerry Received on Thu Jul 06 2006 - 16:11:09 CDT