少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(22)

          我參與的團隊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          1、建立存儲過程
          create procedure pabin4()
          BEGIN
          declare status,id int;
          declare az,ax varchar(100) default '';
          declare mycur cursor for select * from abin5;
          declare continue handler for not found set status=1;
          open mycur;
           set status=0;
           loopLabel:LOOP

            fetch mycur into id,az;

            if status = 0 then
             if az is not null then
              set ax=CONCAT(az,'mycur');
             else
              set ax=CONCAT('mysql','mycur');
             end if;
             insert into abin5 values (id,ax);
            end if;

            if status = 1 then
             leave loopLabel;
            end if;

            end loop;
          close mycur;
          END

           

           

           2、測試語句

          call pabin4()
           

          posted on 2012-09-16 03:16 abin 閱讀(488) 評論(0)  編輯  收藏 所屬分類: mysql
          主站蜘蛛池模板: 七台河市| 济阳县| 武乡县| 肃南| 乌鲁木齐市| 堆龙德庆县| 土默特右旗| 龙陵县| 两当县| 柏乡县| 芒康县| 靖远县| 嵩明县| 雷州市| 宾阳县| 靖宇县| 巨鹿县| 孟州市| 新干县| 博湖县| 南川市| 通榆县| 罗田县| 五大连池市| 天峨县| 平安县| 通辽市| 大余县| 当雄县| 姚安县| 吴忠市| 营口市| 阜宁县| 万荣县| 江阴市| 法库县| 福海县| 广东省| 汉寿县| 九台市| 长白|