PL/SQL】DELETE IN PROCEDURE Analysis & Example | oracle数据库: 用procedure删除数据的案例分析
2019-06-20 15:07
1071 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/yawen9790/article/details/93040787
/* procedure practice */ --display original table select * from regions; drop sequence s_regions; --ceshi procedure create or replace procedure add_ceshi( p_id regions.region_id%type, p_name regions.region_name%type) IS begin insert into regions values (p_id, p_name); end add_ceshi; / create sequence s_regions start with 12 increment by 1 cache 2; execute add_ceshi (s_regions.nextval, 'wei'); execute add_ceshi (s_regions.nextval, 'qi'); execute add_ceshi (s_regions.nextval, 'yan'); execute add_ceshi (s_regions.nextval, 'han'); --display table after add-ceshi select * from regions; create or replace procedure de_ceshi( p_id regions.region_id%type) IS begin delete from regions where regions.region_id > p_id; end de_ceshi; / --test 0/ negative value /* execute de_ceshi(-2); select * from regions; */ execute de_ceshi(9); select * from regions;
OUTPUT
REGION_ID REGION_NAME
1 Europe 2 Americas 3 Asia 4 Middle East and Africa
Sequence S_REGIONS dropped.
Procedure ADD_CESHI compiled
Sequence S_REGIONS created.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
REGION_ID REGION_NAME
12 wei 13 qi 14 yan 15 han 1 Europe 2 Americas 3 Asia 4 Middle East and Africa
8 rows selected.
Procedure DE_CESHI compiled
PL/SQL procedure successfully completed.
REGION_ID REGION_NAME
1 Europe 2 Americas 3 Asia 4 Middle East and Africa
相关文章推荐
- 【PL/SQL】ME IN PROCEDURE Analysis & Example | oracle数据库: 用procedure合并数据的案例分析GE
- Oracle 11g数据库使用pl/sql developer进行数据导入与导出
- 将EXCEL表的数据,通过PL/SQL DEVELOPER导入Oracle数据库
- oracle(PL/SQL)表操作:创建表时检查数据库是否存在该表,若存在删除再创建
- 之前创建了一个表空间,然后今天不小心把表空间文件给删除了。然后用pl/sql连接数据库的时候,报ORA-01033错误。ora-01033:oracle initializationg or shut
- oracle 数据库数据类型和PL/SQL数据类型
- pl/sql入门第四章--数据库数据对象分析(上)
- 数据库编程实战:Oracle PL/SQL入门之案例实践
- pl/sql入门第五章--数据库数据对象分析(下)
- oracle(PL/SQL)表操作:创建表时检查数据库是否存在该表,若存在删除再创建
- 《Oracle PL/SQL 完全自学手册》读书笔记 第5章 数据的增、删、改-- 5.3.4 TRUNCATE与DELETE的区别
- oracle(PL/SQL)表操作:创建表时检查数据库是否存在该表,若存在删除再创建
- oracle 数据库的管理工具 PL/SQL_Developer 的简易使用 与Java 连接并查询显示出数据
- SQL truncate 、delete与drop区别及 MSSQL、MySQL 数据库删除大批量千万级百万级数据的优化
- oracle 复合数据类型(pl/sql记录)
- Oracle PL/SQL入门案例实践
- 不安装 oracle的客户,就可以使用pl/sql访问远程oracle 数据库的方法
- PL/SQL Developer 或Toad 不安装Oracle 客户端连接数据库
- ORACLE用PL/SQL提交数据后执行回滚的方法
- PL/SQL数据类型和效率分析