博客
关于我
[oracle] 学习_持续更新
阅读量:395 次
发布时间:2019-03-05

本文共 2535 字,大约阅读时间需要 8 分钟。

Oracle 教程目录(自学指南)

1. 创建与管理表

1.1 创建表

create table TEST_PARA (    name        VARCHAR2(100) not null,    sql         CLOB,    create_time DATE);

1.2 修改字段长度

alter table WX_INVOICES modify shop_director_tel varchar2(50);

1.3 管理序列

-- 创建序列create sequence SEQ_TABLE     minvalue 1     maxvalue 999999999999999999999999999     start with 15     increment by 1     nocache;-- 查询序列下一个值select SEQ_TABLE.nextval from dual;-- 删除序列drop sequence SEQ_TABLE;

2. 动态 SQL 与强制执行

2.1 动态 SQL 应用

execute immediate ('TRUNCATE TABLE TABLE'); -- 动态执行存储过程V_SQL = 'BEGIN PROC(I_YF,O_RET_CODE,O_RET_NOTE);END;';execute immediate V_SQL using (IN) I_YF, (OUT) O_RET_CODE, (OUT) O_RET_NOTE;-- 动态检索数据execute immediate 'select count(1) from table' into v_sql;execute immediate 'insert into table (int) values (:X)' using i;

2.2 截取日期年月日

select     to_date('201904', 'YYYYMM') as date_str,    extract(year from to_date('201904', 'YYYYMM')) as year,    extract(month from to_date('201904', 'YYYYMM')) as month,    extract(day from to_date('201904', 'YYYYMM')) as day,    extract(year from sysdate) as year_sys,    extract(month from sysdate) as month_sys,    extract(day from sysdate) as day_sys,    extract(year from date '2015-05-04') as year_date,    extract(month from date '2015-05-04') as month_date,    extract(day from date '2011-05-04') as day_datefrom dual;

3. 循环与字符串操作

3.1 FOR 循环

for x in 1..v_cnt loop    -- 循环体end loop;

3.2 行转列

select     reg_replace('xxyyzziioo', 'xx|zz|oo$', '') from dual;

4. 数据验证与转换

4.1 手机格式验证

select     max(1) as flag from dual where regexp_like(:MOBILE, '^[1]{1}[3456789]{1}[[:digit:]]{9}$');

5. 数据排序与统计

5.1 取最大值或最小值

select     max(a.column) keep(dense_rank last order by a.column) from table a;

6. 查看系统信息

6.1 查看外键关联表

select * from user_constraints cc where cc.r_constraint_name in (    select c.r_constraint_name     from user_constraints c     where c.constraint_type = 'R'     and c.constraint_name = 'FK_MT_SCH_L_REFERENCE_MT_SCH');

7. 事务管理与优化

7.1 数据库回退

flashback table ecif.TJG_DX to timestamp to_timestamp('2017-09-05 12:30:00', 'YYYY-MM-DD HH24:mi:ss');

8. 特殊字符处理

8.1 去空格与回车

select     ltrim(rtrim(replace(replace('qwe123', chr(10), ''), chr(13), '')) from dual;

9. 触发器应用

9.1 创建触发器

create or replace trigger Temptable_TESTbefore insert or update on Temptable_TESTfor each rowwhen (old.n1 > 100)begin    insert into Temptable_TEST_his (C1, C2) values ('de_trig', :old.c2);end;

10. 树遍历结构

10.1 树结构查询

select id from lborganizationconnect by prior id = fidstart with id = ***;

以上内容为Oracle数据库管理的实用指南,涵盖了从基础操作到高级功能的多个方面,旨在为学习者提供全面的学习资源。

转载地址:http://trdzz.baihongyu.com/

你可能感兴趣的文章
Node-RED中连接Mysql数据库并实现增删改查的操作
查看>>
Node-RED中通过node-red-ui-webcam节点实现访问摄像头并截取照片预览
查看>>
Node-RED中配置周期性执行、指定时间阶段执行、指定时间执行事件
查看>>
Node-RED安装图形化节点dashboard实现订阅mqtt主题并在仪表盘中显示温度
查看>>
Node-RED怎样导出导入流程为json文件
查看>>
Node-RED订阅MQTT主题并调试数据
查看>>
Node-RED通过npm安装的方式对应卸载
查看>>
node-request模块
查看>>
node-static 任意文件读取漏洞复现(CVE-2023-26111)
查看>>
Node.js 8 中的 util.promisify的详解
查看>>
node.js debug在webstrom工具
查看>>
Node.js GET、POST 请求是怎样的?
查看>>
Node.js HTTP模块详解:创建服务器、响应请求与客户端请求
查看>>
Node.js RESTful API如何使用?
查看>>
node.js url模块
查看>>
Node.js Web 模块的各种用法和常见场景
查看>>
Node.js 之 log4js 完全讲解
查看>>
Node.js 函数是什么样的?
查看>>
Node.js 函数计算如何突破启动瓶颈,优化启动速度
查看>>
Node.js 切近实战(七) 之Excel在线(文件&文件组)
查看>>