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.静态游标的更多相关文章

  1. 【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 ...

  2. 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 ...

  3. MySQL PLSQL Demo - 002.变量定义、赋值

    drop procedure if exists p_hello_world; create procedure p_hello_world() begin declare v_number int; ...

  4. MySQL PLSQL Demo - 001.创建、调用、删除过程

    drop procedure if exists p_hello_world; create procedure p_hello_world() begin select sysdate(); end ...

  5. Mysql 存储过程中使用多游标

    Mysql 存储过程中使用多游标 drop procedure IF EXISTS test_proc_1; create procedure test_proc_1() begin ; ) ; ) ...

  6. java jdbc使用SSH隧道连接mysql数据库demo

    java jdbc使用SSH隧道连接mysql数据库demo   本文链接:https://blog.csdn.net/earbao/article/details/50216999   packag ...

  7. sulin Python3.6爬虫+Djiago2.0+Mysql --实例demo

    1.切换到项目目录下,启动测试服务器 manage.py runserver 192.168.0.108:8888 2.设置相关配置 项目目录展示如下: beauty=>settings.py ...

  8. Oracle PLSQL Demo - 20.弱类型REF游标[没有指定查询类型,也不指定返回类型]

    declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; v_ename ); v_deptno ); v ...

  9. Oracle PLSQL Demo - 17.游标查询个别字段(非整表)

    declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; v_empno scott.emp.empno% ...

随机推荐

  1. Flume wasn't able to parse timestamp header

    来自:http://caiguangguang.blog.51cto.com/1652935/1384187 flume bucketpath的bug一例 测试的配置文件: 1 2 3 4 5 6 7 ...

  2. PHPstorm自定义快捷键

    Ctrl+alt+S 打开设置 PHPstorm 设置 PHPstorm 主题安装 自定义快捷键设置 ·全屏 F11 ·另外一种全屏alt+F11 Database数据库管理 alt+d Termin ...

  3. word2vec模型cbow与skip-gram的比较

    cbow和skip-gram都是在word2vec中用于将文本进行向量表示的实现方法,具体的算法实现细节可以去看word2vec的原理介绍文章.我们这里大体讲下两者的区别,尤其注意在使用当中的不同特点 ...

  4. 如何从maven资源库下载jar包

      如何从maven资源库下载jar包 CreationTime--2018年6月7日09点00分 Author:Marydon 一.前提 需要安装并配置maven环境 二.准备工作 1.在桌面创建一 ...

  5. eclipse 如何运行mavenWeb项目

      1.使用maven 首先,在eclipse中,使用maven对项目进行打包: 其次,将项目发布到Tomcat服务器上 说明: demo_WebService2-0.0.1-SNAPSHOT文件夹存 ...

  6. [TODO]com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method

    异常信息如下: 2018-10-30 20:00:50.230 ERROR java.util.concurrent.ExecutionException: com.alibaba.dubbo.rpc ...

  7. spyder python 相关

    1.python开发集成工具Spyder中,如何设置变量成员提示和代码补全呢? 答: pip install rope,安装好rope 就可以了 2.最常用的是:tap的制动补全 (IPython c ...

  8. More Effective C++:通过引用捕获异常

    当你写一个catch子句时,必须确定让异常通过何种方式传递到catch子句里.你可以有三个选择:与你给函数传递参数一样,通过指针(by pointer),通过传值(by value)或通过引用(by ...

  9. Spark GraphX 的数据可视化

    概述 Spark GraphX 本身并不提供可视化的支持, 我们通过第三方库 GraphStream 和 Breeze 来实现这一目标 详细 代码下载:http://www.demodashi.com ...

  10. redis安装配置文件配置

    环境: 虚拟机redhat5.5安装redis4.0.2 虚拟机IP:192.168.60.130 reids端口:6379 安装步骤不详述了(可参考: 亲密接触Redis-第一天), 大致步骤如下: ...