博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle 存储过程A
阅读量:6259 次
发布时间:2019-06-22

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

create or replace procedure users_procedure is  cursor users_cursor is select * from users;  v_id users.id%type;  v_username users.username%type;  v_password users.password%type;begin  open users_cursor;  fetch users_cursor into v_id, v_username, v_password;  while users_cursor%found    loop      dbms_output.put_line('v_id = ' || v_id || 'v_username = ' || v_username || 'v_password = ' || v_password);      fetch users_cursor into v_id, v_username, v_password;    end loop;  close users_cursor;end;/create or replace procedure users_batch_insert_procedure is  v_id users.id%type;  v_username users.username%type;  v_password users.password%type;begin  for i in 0..1000    loop      v_id := i;      v_username := 'abc' || i;      v_password := 'efg' || i;      insert into users values(v_id, v_username, v_password);      commit;    end loop;end;/create or replace procedure users_a is  type users_cursor_type is ref cursor; --return users%rowtype;  type users_record_type is record (v_id users.id%type, v_username users.username%type, v_password users.password%type);  v_sql varchar2(2000);  users_cursor_a users_cursor_type;  users_record users_record_type;begin  v_sql := 'select * from users';  open users_cursor_a for v_sql;  fetch users_cursor_a into users_record;  while users_cursor_a%found    loop      dbms_output.put_line('v_id = ' || users_record.v_id || 'v_username = ' || users_record.v_username || 'v_password = ' || users_record.v_password);      fetch users_cursor_a into users_record;    end loop;  close users_cursor_a;end;/create or replace procedure users_a is  type users_cursor_type is ref cursor return users%rowtype;  v_row users%rowtype;  v_sql varchar2(2000);  users_cursor_a users_cursor_type;begin    open users_cursor_a for select * from users;  fetch users_cursor_a into v_row;  while users_cursor_a%found    loop      dbms_output.put_line('v_id = ' || v_row.id || 'v_username = ' || v_row.username || 'v_password = ' || v_row.password);      fetch users_cursor_a into v_row;    end loop;  close users_cursor_a;end;/set serveroutput on size 1000000;

 

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

你可能感兴趣的文章
【转载】APK反破解之四:Android代码动态加载技术
查看>>
(转)iOS Wow体验 - 第三章 - 用户体验的差异化策略
查看>>
vsftp配置大全---超完整版
查看>>
继:我朝特有需求之--英文字符占 0.5 个,中文字符占 1 个
查看>>
关于 Overtrue 的拼音库 overtrue/pinyin 为何 travis 为 error
查看>>
ASP.NET Word/Excel 权限问题
查看>>
IOS 3D UI --- CALayer的transform扩展
查看>>
img绝对定位在div中间,img上下稍微移动问题
查看>>
前序遍历构造已知二叉树(二叉链表实现)(Java)
查看>>
查看CentOS版本
查看>>
关于VS 中 HttpHandler 的设置 500.23
查看>>
19.04.27--作业 打字游戏
查看>>
连接Access数据库的DAL层操作代码
查看>>
mysql重置auto_increment字段
查看>>
MySQL的优化
查看>>
bzoj1702[Usaco2007 Mar]Gold Balanced Lineup 平衡的队列*
查看>>
分享到
查看>>
OpenCV Error: Assertion failed (data0.dims <= 2 && type == 5 && K > 0) in cv::kmeans
查看>>
【开篇】洛神赋
查看>>
Vue.js 学习报告
查看>>