-------------------- -- 这里是查询 数字型字段值 /*declare CURSOR cur_query IS select table_name, column_name, data_type from user_tab_columns; a number; sql_hard varchar2(2000); vv number; begin for rec1 in cur_query loop a:=0; if rec1.data_type ='NUMBER' THEN
注:下面的一部分查询只能由admin执行,我会在查询的末尾以"-priv“标注. 探测版本: SELECT banner FROM v$version WHERE banner LIKE ‘Oracle%’; SELECT banner FROM v$version WHERE banner LIKE ‘TNS%’; SELECT version FROM v$instance; 注释: SELECT 1 FROM dual — comment 注: Oracle的SELECT语句必须包含FRO
select relname as TABLE_NAME, reltuples as rowCounts from pg_class where relkind = 'r' and relnamespace = (select oid from pg_namespace where nspname='public') order by rowCounts desc; select * from information_schema.columns where table_schema='publ
方法1: --Oracle 根据字段值查询其所在的表.字段 DECLARE CURSOR cur_query IS SELECT table_name, column_name, data_type FROM user_tab_columns; a NUMBER; sql_hard VARCHAR2(); vv NUMBER; BEGIN FOR rec1 IN cur_query LOOP a:=; IF rec1.data_type ='VARCHAR2' OR rec1.data_type
现在有两个表,A表字段AMOUNT为发票金额,B表字段REV为收款金额,两表通过字段id关联,需将A表的字段AMOUNT与B表的字段REV相减, 但是A表表示的发票可能对应多个B表的收款金额,如何将A表的AMOUNT与对应的B表的多个REV值的和相减,得到未收款金额 select a.id,(nvl(a.AMOUNT,0)-nvl(b.REV,0)) Result from a, (select b.id,sum(b.REV) REV from b
获取表名: Oracle的user_talbes用于记录了用户表信息. select * from user_tables 获取某个表的字段: USER_TAB_COLS中记录了用户表的列信息.下面是别人写的: 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
获取表:select table_name from user_tables; //当前用户拥有的表 select table_name from all_tables; //所有用户的表 select table_name from dba_tables; //包括系统表 select table_name from dba_tables where owner='用户名' user_tables: table_name,tablespace_name,last_analyzed等 dba_t
获取表: select table_name from user_tables; //当前用户拥有的表 select table_name from all_tables; //所有用户的表 select table_name from dba_tables; //包括系统表 select table_name from dba_tables where owner='用户名' user_tables: table_name,tablespace_name,last_analyzed等 dba_
获取表字段: select * from user_tab_columns where Table_Name='用户表' order by column_name 获取表注释: select * from user_tab_comments where Table_Name='用户表' order by Table_Name 获取字段注释: select * from user_col_comments where Table_Name='用户表' order by column_name /*