MySQL PLSQL Demo - 003.静态游标
drop procedure if exists p_hello_world; create procedure p_hello_world()
begin
declare id integer;
declare username varchar(256);
declare result varchar(4000) default '';
/* don't work */
/*declare cur_user cursor for select id from p_user where id is not null and name is not null order by id;*/
declare cur_user cursor for select t.id, t.name from p_user t where t.id is not null and t.name is not null order by t.id;
declare continue handler for SQLSTATE '' set id = null;
open cur_user;
fetch cur_user into id, username;
while (id is not null) do
set result = concat(result, 'id:', id, 'username:', username, ';');
fetch cur_user into id, username;
end while;
close cur_user;
select result;
end; call p_hello_world();
MySQL PLSQL Demo - 003.静态游标的更多相关文章
- 【MySQL】MySQL PLSQL Demo - 006.循环(WHILE DO and FOR LOOP)
WHILE DO drop procedure if exists p_while_do; create procedure p_while_do() begin declare i int; ; d ...
- MySQL PLSQL Demo - 005.IF THEN ELSEIF THEN ELSE END IF
drop procedure if exists p_hello_world; create procedure p_hello_world(in v_id int) begin ) then sel ...
- MySQL PLSQL Demo - 002.变量定义、赋值
drop procedure if exists p_hello_world; create procedure p_hello_world() begin declare v_number int; ...
- MySQL PLSQL Demo - 001.创建、调用、删除过程
drop procedure if exists p_hello_world; create procedure p_hello_world() begin select sysdate(); end ...
- Mysql 存储过程中使用多游标
Mysql 存储过程中使用多游标 drop procedure IF EXISTS test_proc_1; create procedure test_proc_1() begin ; ) ; ) ...
- java jdbc使用SSH隧道连接mysql数据库demo
java jdbc使用SSH隧道连接mysql数据库demo 本文链接:https://blog.csdn.net/earbao/article/details/50216999 packag ...
- sulin Python3.6爬虫+Djiago2.0+Mysql --实例demo
1.切换到项目目录下,启动测试服务器 manage.py runserver 192.168.0.108:8888 2.设置相关配置 项目目录展示如下: beauty=>settings.py ...
- Oracle PLSQL Demo - 20.弱类型REF游标[没有指定查询类型,也不指定返回类型]
declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; v_ename ); v_deptno ); v ...
- Oracle PLSQL Demo - 17.游标查询个别字段(非整表)
declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; v_empno scott.emp.empno% ...
随机推荐
- HTTP Content-type整理
文件扩展名 Content-Type(Mime-Type) 文件扩展名 Content-Type(Mime-Type) .*( 二进制流.不知道下载文件类型) application/octet-st ...
- YUM常用命令详解
yum是一个用于管理rpm包的后台程序,用python写成,可以非常方便的解决rpm的依赖关系.在建立好yum服务器后,yum客户端可以通过 http.ftp方式获得软件包,并使用方便的命令直接管理. ...
- PHP 循环
PHP 中的循环语句用于执行相同的代码块指定的次数. 循环 在您编写代码时,您经常需要让相同的代码块运行很多次.您可以在代码中使用循环语句来完成这个任务. 在 PHP 中,我们可以使用下列循环语句: ...
- 创建简单的Telnet实例
step1.先加入库SuperSocket.Common.dll, SuperSocket.SocketBase.dll, SuperSocket.SocketEngine.dll,log4net.d ...
- Nginx的HTTPS 301重定向到另一个TLD(托管在同一服务器上)没有显示出SSL警告
我自己 example.com, .com.au, .net, .net.au, ... (8 in total). 我想所有的这些顶级域名以301的域名重定向到安全.COM域 https://www ...
- static不实现多态
class Father { public static String getName() { return "father"; } } class Children extend ...
- ssh之为什么要放弃ssh?
本文经转载, 源出处不详.https://www.cnblogs.com/hackxiyu/p/6849085.html 最近听一些朋友说,招聘面试的很多人简历都差不多,大部分人的简历上面都写了熟悉s ...
- 如何用python轻松破解wifi密码( 源码 )
摘要: 我得说明下这个东西一点都不高端,甚至看起来有点糟糕.而且用的是单线程~,因为过几天要搬家了,于是.. 环境准备 python2.7 凑合的linux 差不多的无线网卡 pywifi模块 弱口令 ...
- 【LeetCode】104. Maximum Depth of Binary Tree (2 solutions)
Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the ...
- Android开发学习之3大类菜单
在Android系统中,菜单可以分为三类:选项菜单(Option Menu),上下文菜单(Context Menu)以及子菜单(Sub Menu). 一.选项菜单(Option Menu) 创建选项菜 ...