This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
oracle开发 [2019/11/08 11:40] jordan [查询用户的所有字段] |
oracle开发 [2023/03/08 16:09] (current) xujianglong ↷ Page moved from 内部资料:oracle开发 to oracle开发 |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | # PL SQL | + | ====== |
- | # Oracle常用查询语句 | + | ====== |
- | ## 查询数据库/ | + | ===== 查询数据库/ |
- | ```sql | + | < |
select * from sys.user_tablespaces; | select * from sys.user_tablespaces; | ||
select * from sys.dba_data_files; | select * from sys.dba_data_files; | ||
select * from sys.user_tables; | select * from sys.user_tables; | ||
- | ``` | + | </ |
+ | ===== 查询用户的所有字段 ===== | ||
- | ## 查询用户的所有字段 | + | < |
- | ```sql | + | |
select * from all_tab_columns where owner = '< | select * from all_tab_columns where owner = '< | ||
- | ``` | + | </ |
+ | ===== 查询用户所有字段的注释 ===== | ||
- | ## 查询用户所有字段的注释 | + | < |
- | ```sql | + | |
select * from all_col_comments where owner = '< | select * from all_col_comments where owner = '< | ||
- | ``` | + | </ |
+ | ===== 查询所有约束 ===== | ||
- | # Oracle的几个坑 | + | 参考:[[https:// |
- | ## 与Hibernate共用时,数据库中插入的自动生成的值与sequence的当前值差别很大 | + | <code sql> |
+ | SELECT * FROM all_constraints WHERE constraint_name = '< | ||
+ | </ | ||
+ | ====== Oracle的几个坑 ====== | ||
- | Hibernate默认allocationSize为50,这样会每次取50个id作为缓存,如果服务器重次,则再取50个,而sequence在项目中每次缓存20,会插入数据库的值与sequance的值会有差别。详见[更多资料](http:// | + | ===== 与Hibernate共用时,数据库中插入的自动生成的值与sequence的当前值差别很大 ===== |
- | ## Null的判断 | + | Hibernate默认allocationSize为50,这样会每次取50个id作为缓存,如果服务器重次,则再取50个,而sequence在项目中每次缓存20,会插入数据库的值与sequance的值会有差别。详见[[http:// |
+ | |||
+ | ===== Null的判断 | ||
语句中不能用=, | 语句中不能用=, | ||
- | ## 排序字段值不唯一导致随机乱序 | + | ===== 排序字段值不唯一导致随机乱序 |
Order By时,如果排序字段的值不唯一,需要加上一个唯一值字段作为第二排序依据,否则可能会导致分页时,字段值相同的数据出现的位置不固定,导致有些部分数据在不同页面重复出现,另外有部分数据不能显示 | Order By时,如果排序字段的值不唯一,需要加上一个唯一值字段作为第二排序依据,否则可能会导致分页时,字段值相同的数据出现的位置不固定,导致有些部分数据在不同页面重复出现,另外有部分数据不能显示 | ||
+ | |||
+ | ====== Oracle修改自增长ID字段初始值 ====== | ||
+ | |||
+ | 参考:[[https:// | ||
+ | |||
+ | <code sql> | ||
+ | ALTER TABLE | ||
+ | </ | ||
+ |