使用对象类型+在存储过程使用+在函数中使用
来源:互联网 发布:广联达软件安装 编辑:程序博客网 时间:2024/06/05 19:01
使用对象类型
在存储过程使用
增删改查
--查询create or replace procedure select_stu_class(cid in stu_class.id%TYPE)as stu_c class4;beginselect value(sc) into stu_c from stu_class sc where id=cid;dbms_output.put_line(stu_c.id||' '||stu_c.name);end select_stu_class;/--插入create or replace procedure insert_stu_class(cid in stu_class.id%TYPE,cname in stu_class.name%TYPE)as v_stu_c class4:=class4(cid,cname);begininsert into stu_class values(v_stu_c);exceptionwhen others then rollback;end insert_stu_class;/--更新create or replace procedure update_stu_class(v_class4 in class4)as beginupdate stu_class sc set sc=v_class4 where id=v_class4.id;exceptionwhen others then rollback;end update_stu_class;/--删除create or replace procedure delete_stu_class(cid in stu_class.id%TYPE)as begindelete stu_class where id=cid;exceptionwhen others then rollback;end delete_stu_class;/ call select_stu_class(1101); call insert_stu_class(1103,'英语'); select * from stu_class; call update_stu_class(class4(1103,'商务英语')); select * from stu_class; call delete_stu_class(1103); select * from stu_class;
在函数中使用
在函数中使用1
--函数create or replace function select_stu_class_function(cid in stu_class.id%TYPE) return class4 asstu_c class4;beginselect value(sc) into stu_c from stu_class sc where id=cid;return stu_c;end select_stu_class_function;select select_stu_class_function(1101) from dual;/
在函数中使用2
create or replace function select_stu_class_function2(cid in stu_class.id%TYPE) return ref class4 asstu_c ref class4;beginselect ref(sc) into stu_c from stu_class sc where id=cid;return stu_c;end select_stu_class_function2;/ select deref(select_stu_class_function2(1101)) from dual;
阅读全文
0 0
- 使用对象类型+在存储过程使用+在函数中使用
- 在Asp中使用存储过程 数值类型值
- 在Asp中使用存储过程 数值类型值
- 在Asp中使用存储过程数值类型值
- 在Asp中使用存储过程数值类型值
- 在Asp中使用存储过程数值类型值
- 存储过程: 函数 不能在SQL中使用
- 查询函数在哪些存储过程中使用
- 在 Access 中使用“存储过程”[转帖]
- 学会在ASP中使用存储过程
- 学会在ASP中使用存储过程
- 在 Access 中使用“存储过程”
- 在存储过程中使用动态sql
- 在ASP中使用存储过程
- 在ASP中使用存储过程
- 在ASP中使用存储过程
- 学会在ASP中使用存储过程
- 在vb.net中使用存储过程
- Paint的高级渲染
- 什么是微信小程序?
- Failed to execute goal org.apache.maven.plugins:maven-war-plugin 解决办法
- 2017年第0届浙江工业大学之江学院程序设计竞赛决赛 A: qwb与支教 [容斥]【数学】
- 数据结构之顺序表
- 使用对象类型+在存储过程使用+在函数中使用
- 小程序会取代APP吗?
- ---博弈论---
- builder模式——实现具名可变参数
- 2017年第0届浙江工业大学之江学院程序设计竞赛决赛 B: qwb与矩阵
- x86 保护模式寻址
- 新概念4-11
- 静态顺序表接口的简单实现
- 闹钟实例与远程机制AIDL工具android:process=":remote"结合应用