oracle 相关笔记
1.查询语句执行顺序 from->where->[group by ]-> select ->distinct->count(某一列)
2.用命令执行存储过程用 exec 或 begin and /
3.oracle 定义变量, declare 关键字来定义。 定义常量,用constant, 也可以%type 来定义,%rowtype来定义。
4.oracle 常用函数:https://www.cnblogs.com/chuangege/p/6258658.html
5.oracle的if判断 if then elsif then else end if case when end case;
6.oracle的循环: 1种:loop end loop; 2种: while loop end loop
3种: for v_i *** in reverse 1 .. 3 loop end loop 倒序遍历
for v_i *** in 1 .. 3 loop end loop;
7.oracle 中 编译时异常无法捕获。sqlcode 获取异常代码 sqlerrm 获取异常错误信息
8.oracle 中 定义记录类型 type *** is record(.....);
9.oracle 中定义记录类型例子:
declare
type fpagent_type is record(
agentid fpagent.agentid%type,
agentjid fpagent.agentjid%type,
name fpagent.name%type,
maxchats fpagent.maxchats%type,
minchats fpagent.minchats%type
);
v_fpagent fpagent_type;
v_agentid number := &agentid;
begin
select * into v_fpagent from fpagent where agentid=v_agentid;
dbms_output.put_line('agentid:'||v_fpagent.agentid);
dbms_output.put_line('agentjid:'||v_fpagent.agentjid);
dbms_output.put_line('name:'||v_fpagent.name);
dbms_output.put_line('maxchats:'||v_fpagent.maxchats);
dbms_output.put_line('minchats:'||v_fpagent.minchats);
end;
/
注意:select 出来的字段顺序要与type定义的顺序一致。
10.oracle 索引表:
例子:
11.commit事物以后,不能用rollback回滚 如果要找回的话 可以用闪回
12.我们所用到的表都存放到Users表空间里。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人