随笔分类 -  oracle

oracle 基本命令和常见问题的处理
摘要:1,获取具体表的字段相关信息 SELECT col_description (a.attrelid, a.attnum) as comment, format_type (a.atttypid, a.atttypmod) as type, a.attname as name, a.attnotnul 阅读全文
posted @ 2022-05-06 15:43 iullor 阅读(293) 评论(0) 推荐(0) 编辑
摘要:1,函数类 时间函数 #获取当前时间 select now(); #将时间类型转换为字符串类型 timestamp/date可选 SELECT to_char(now()::timestamp , 'YYYY-MM-DD HH24:MI:ss')::text 阅读全文
posted @ 2022-02-14 16:31 iullor 阅读(172) 评论(0) 推荐(0) 编辑
摘要:转载:https://blog.csdn.net/u010429286/article/details/79022484 自理解: 1,MySQL 其 schema 基本上和 database 等同 表所属在具体的schema下; 在程序中 jdbc:mysql://xxx:3306/数据库名称(s 阅读全文
posted @ 2022-01-05 13:35 iullor 阅读(312) 评论(0) 推荐(0) 编辑
摘要:1,获取表 信息 select * from information_schema."tables" t ; 2,获取字段详情 select * from information_schema.columns c where c.table_name ='表名'; 3,获取表具体字段备注信息 SEL 阅读全文
posted @ 2021-12-28 14:19 iullor 阅读(274) 评论(0) 推荐(0) 编辑
摘要:1,批量插入 2,批量更新 3,多参数传值问题 4,插入(更新)后获取主键 6,若数据不存在插入(更新) 7,多列条件in查询 8,参数List、Map 循环问题 Map : https://www.cnblogs.com/xr210/p/13224552.html 阅读全文
posted @ 2021-12-22 10:54 iullor 阅读(102) 评论(0) 推荐(0) 编辑
摘要:oracle 获取表信息 1.查询所有的字段名以列的形式输出 select * from dba_tab_cols where table_name='DATA_UPLOAD_RECORDS' AND OWNER='CM';--表名要大写 2.查询所有的字段名以行的形式输出 select wm_co 阅读全文
posted @ 2021-10-27 18:00 iullor 阅读(203) 评论(0) 推荐(0) 编辑
摘要:###一、行转列listagg函数: ###场景:这里的表数据使用的是oracle默认的scott账户下的emp(员工)表。 规范写法 : LISTAGG(字段, 连接符) WITHIN GROUP (ORDER BY 字段) 通常情况下,LISTAGG是满足需要的,LISTAGG 返回的是一个va 阅读全文
posted @ 2021-06-05 14:36 iullor 阅读(1934) 评论(0) 推荐(0) 编辑
摘要:需求关联日志,呈现以下效果,使用 ROW_NUMBER() OVER(PARTITION BY ) 函数 排序分组函数 ID 1 2 3 4 5 效果 | 1 | 2 | | | | | 2 | 3 | | 3 | 4 | | 4 | 5 | 日志表图 换床的日志记录 结果表图 ,期待结果 换床前床 阅读全文
posted @ 2021-05-28 16:34 iullor 阅读(201) 评论(0) 推荐(0) 编辑
摘要:####需求,当符合条件1 修改 A表 或 新增 A表 oracle 写法 语法: merge into 目标表 a using 源表 b on(a.条件字段1=b.条件字段1 and a.条件字段2=b.条件字段2 ……) when matched then update set a.更新字段=b 阅读全文
posted @ 2021-05-28 16:06 iullor 阅读(169) 评论(0) 推荐(0) 编辑
摘要:select * from (select * from 表名 where 条件 order by 排序日期 desc) where rownum=1; select * from (select * from TABLE where STATE = 3 order by TIME desc) wh 阅读全文
posted @ 2021-02-20 11:18 iullor 阅读(1040) 评论(0) 推荐(0) 编辑
摘要:感谢老哥,解决了我的疑惑 https://www.cnblogs.com/yscit/p/10376005.html https://www.cnblogs.com/ybhcolin/archive/2013/04/17/3026646.html ###一、概述 Oralce中的任务有2种:Job和 阅读全文
posted @ 2020-07-27 11:01 iullor 阅读(3351) 评论(0) 推荐(0) 编辑
摘要:###第一种 函数 wm_content('待转列名称') 11g 往后,不推荐使用 ###实例 多表关联时可以使用 (SELECT wm_concat(nvl(B1.OPERA_CODE,'a')) AS OPERA_CODE FROM OPERATION_NAME B1 WHERE T1.OPE 阅读全文
posted @ 2020-07-16 23:41 iullor 阅读(447) 评论(0) 推荐(0) 编辑
摘要:一、查询的逻辑执行顺序 复制代码 (1) FROM left_table (3) join_type JOIN right_table (2) ON join_condition (4) WHERE where_condition (5) GROUP BY group_by_list (6) WIT 阅读全文
posted @ 2020-04-13 09:53 iullor 阅读(202) 评论(0) 推荐(0) 编辑
摘要:常用数据字典 可以使用desc 查看结构 dba_users dba_tablespaces user_users user_tablespaces dba_data_files #文件数据,可查看表空间的实际存储位置 USER_CONSTRAINTS; #查询数据字典可以看到某个表中约束的信息 # 阅读全文
posted @ 2020-02-09 13:10 iullor 阅读(281) 评论(0) 推荐(0) 编辑
摘要:从定义中我们可以看出方案(Schema)为数据库对象的集合,为了区分各个集合,我们需要给这个集合起个名字,这些名字就是我们在企业管理器的方案下看到的许多类似用户名的节点,这些类似用户名的节点其实就是一个schema,schema里面包含了各种对象如tables, views, sequences, 阅读全文
posted @ 2020-01-15 09:15 iullor 阅读(687) 评论(0) 推荐(0) 编辑