Table names might be stored in capital letters such that a condition table_name='StudentInfo'
fails. Note that Oracle (and most other RDBMS I know) compare strings in a case sensitive manner. For a case insensitive comparison, use UPPER
(or LOWER
) on both arguments. So the following query should work safely:
select column_name from cols where upper(table_name)=upper('StudentInfo')
There are other ways of turning string comparison into case insensitive, like altering session parameters NLS_COMP
and NLS_SORT
(cf., for example, https://stackoverflow.com/a/5391234/2630032 and upvote this reference if applicable). By using UPPER
, however, you make your query independent of such settings.