select * from all_table_columns where tablename = BadDut."dutbin"; 用户名要写到双引号的外面 dutbin可能要改成大写 如果建表的时候没有用双引号,这里的双引号也可以去掉
呵呵 好像确实是有点错 你查这个视图ALL_TAB_COLUMNS
看错了。 select * from all_tab_cols where upper(table_name) = 'DUTBIN' and owner='BADDUT';
“BadDut.dutbin”就是我的表名,我命名的时候就是这么设的。
SELECT USER_TAB_COLS.TABLE_NAME as 表名, USER_TAB_COLS.COLUMN_NAME as 列名 , USER_TAB_COLS.DATA_TYPE as 数据类型, USER_TAB_COLS.DATA_LENGTH as 长度, USER_TAB_COLS.NULLABLE as 是否为空, USER_TAB_COLS.COLUMN_ID as 列序号, user_col_comments.comments as 备注 FROM USER_TAB_COLS inner join user_col_comments on user_col_comments.TABLE_NAME=USER_TAB_COLS.TABLE_NAME and user_col_comments.COLUMN_NAME=USER_TAB_COLS.COLUMN_NAME where USER_TAB_COLS.Table_Name='A'
ORACLE会自动将你的表名变为大写,查询的时候写大写的表名,就可以查到
select * from all_tab_cols where table_name = 'BadDut.dutbin';
select column_name from all_tab_cols where table_name = 'DUTBIN' and owner='BADDUT';
成功了。 select * from all_tab_cols where table_name = 'BadDut.dutbin';可行
……好吧 select column_name from all_tab_cols where table_name = 'BADDUT.DUTBIN' ;
select * from user_tab_columns where table_name='TABLE_NAME'; 或 select * from all_tab_columns where table_name='TABLE_NAME';
我的例句是这样的:desc "country.city"
说表或者视图不存在
用户名要写到双引号的外面
dutbin可能要改成大写
如果建表的时候没有用双引号,这里的双引号也可以去掉
select * from all_tab_cols where upper(table_name) = 'DUTBIN' and owner='BADDUT';
USER_TAB_COLS.COLUMN_NAME as 列名 ,
USER_TAB_COLS.DATA_TYPE as 数据类型,
USER_TAB_COLS.DATA_LENGTH as 长度,
USER_TAB_COLS.NULLABLE as 是否为空,
USER_TAB_COLS.COLUMN_ID as 列序号,
user_col_comments.comments as 备注
FROM USER_TAB_COLS
inner join user_col_comments on
user_col_comments.TABLE_NAME=USER_TAB_COLS.TABLE_NAME
and user_col_comments.COLUMN_NAME=USER_TAB_COLS.COLUMN_NAME
where USER_TAB_COLS.Table_Name='A'
select * from all_tab_cols where table_name = 'BadDut.dutbin';可行
select column_name from all_tab_cols where table_name = 'BADDUT.DUTBIN' ;
或
select * from all_tab_columns where table_name='TABLE_NAME';