• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

table name in uppercase

If there a query that i can write that will return the results from either of the query whichever returns rows. The character case of the table name could be in any case and not known to me at design time.

select COLUMN_NAME from all_tab_columns where TABLE_NAME='abcdefg'

select COLUMN_NAME from all_tab_columns where TABLE_NAME='ABCDEFG'

or any other case like 'Abcdefg' or 'AbCdEfg'

this query is to be run in oracle and sybase DBs

0
PearlJamFanatic
Asked:
PearlJamFanatic
  • 2
3 Solutions
 
OP_ZaharinCommented:
- in Oracle you can use UPPER or LOWER to forced the data to be in uppercase/lowercase

select COLUMN_NAME from all_tab_columns where UPPER(TABLE_NAME) = UPPER('abcdefg')
0
 
OP_ZaharinCommented:
- to add, the UPPER() function converts all letters in both the column data and the passing variable thus forced both data to be in uppercase regardless of their original case format.
0
 
awking00Commented:
See attached.
comment.txt
0
 
wilcoxonCommented:
In Sybase, you can do:

select c.name from syscolumns c, sysobjects o where o.id = c.id and upper(o.name) = upper('whatever')
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now