Oracle SQL:从all_tab_columns中选择找不到现有列

los*_*its 4 sql oracle oracle-sqldeveloper

如果我运行以下查询:

select count(*) from all_tab_columns
        where column_name = 'foo'
        and table_name = 'VIEW0';
Run Code Online (Sandbox Code Playgroud)

我得到0的结果.我期待1.

但是,如果我运行以下查询,我会返回许多(预期)行:

select foo from VIEW0;
Run Code Online (Sandbox Code Playgroud)

为什么?我假设我正在制作一些愚蠢的语法错误,或者我的理解已经过时了.

Rob*_*ert 8

可能原因是你有区分大小写的设置.

尝试添加UPPER如下功能.

select count(*) from all_tab_columns
        where column_name = upper('foo')
        and table_name = 'VIEW0';
Run Code Online (Sandbox Code Playgroud)