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表空间里。

 

posted on   芝麻开花——节节高  阅读(140)  评论(0编辑  收藏  举报

编辑推荐:
· 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训练数据并当服务器共享给他人

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示