当前位置: 首页 > news >正文

保定哪家做网站好上海三益建筑设计有限公司

保定哪家做网站好,上海三益建筑设计有限公司,dede更新网站,公司名称变更说明存储过程的作用:有助于提高应用程序的性能。存储过程可以不必发送多个冗长的SQL语句 废话不说多#xff0c;直接实操 ##实现num的相加 delimiter $$ CREATE PROCEDURE test1 () begindeclare num int default 0; -- 声明变量,赋默认值为0select num20;end $$ delimiter ; …存储过程的作用:有助于提高应用程序的性能。存储过程可以不必发送多个冗长的SQL语句 废话不说多直接实操 ##实现num的相加 delimiter $$ CREATE PROCEDURE test1 () begindeclare num int default 0; -- 声明变量,赋默认值为0select num20;end $$ delimiter ; --将结束符修改成;call test1(); -- 调用存储过程 drop procedure test1 --如果不需要此存储函数开源删除咯 set赋值操作 delimiter $$CREATE PROCEDURE test2 () begindeclare num int default 0;set num 50; -- 给num变量赋值select num;end $$ delimiter ;call test2();into的使用方法 delimiter $$ CREATE PROCEDURE test3 () begindeclare num int default 0; select count(1) into num from t_student_info; --计算t_student_info表的个数用num来记录select num; end $$ delimiter ; drop procedure test3; 删除该存储函数 call test3();if的使用 delimiter $$ CREATE PROCEDURE test4 () begindeclare id int default 1; declare class_name varchar(20);if id1 thenset class_name要多久你才可以爱上我;elseif id2 thenset class_name不再让自己遗憾了;elseset class_name不用想了谁都不爱我我只爱我自己;end if;select class_name; end $$ delimiter ;call test4(); mysql delimiter; ERROR:  DELIMITER must be followed by a delimiter character or string 使用delimiter;会报错一定要带空格   定义一个输入参数 delimiter $$ CREATE PROCEDURE test5 (in id int) begindeclare class_name varchar(20);if id1 thenset class_name我和xhell脚本的if不一样;elseif id2 thenset class_name我和python中的if语法有一点带你不一样;elseset class_name不用想了不靠别人;end if;select class_name; 注:存储过程中声明了 class_name 变量并对其进行了赋值但并没有通过 SELECT 语句来显示其值。你需要在存储过程末尾添加 SELECT class_name; 语句以便在调用存储过程时返回 class_name 的值end $$ delimiter ;call test5(3); case的使用 delimiter $$ CREATE PROCEDURE test6 (in month int,out season varchar(10)) begincase when month 1 and month3 thenset seasonspring;when month 4 and month6 thenset seasonsummer;when month 7 and month9 thenset seasonautumn;when month 10 and month12 thenset seasonwinter;end case; end $$ delimiter ;call test6(9,season); -- 定义会话变量来接收test8存储过程返回的值select season; xxx代表定义一个会话变量整个会话都可以使用当会话关闭连接断开时销毁 xxx代表定义一个系统变量永久生效。while循环的使用 delimiter $$ CREATE PROCEDURE test7 (in count int) begindeclare total int default 0;declare i int default 1;while icount doset totaltotali;set ii1;end while;select total; end $$ delimiter ;call test7(10);repeat的使用 delimiter $$ CREATE PROCEDURE test7 (count int) -- 默认是输入(in)参数 begindeclare total int default 0;repeat set totaltotalcount;set countcount-1;until count0 -- 结束条件,注意不要打分号end repeat;select total; end $$ delimiter ;call test8(10);使用 select total; 语句输出 total 的最终值。 total 是局部变量只在该存储过程内部有效。 而 total 是用户变量可以在整个会话中使用和共享。 loop的使用 delimiter $$ CREATE PROCEDURE test9 (count int) -- 默认是输入(in)参数 begindeclare total int default 0; sum:loop -- 定义循环标识 set totaltotalcount;set countcount-1;if count 1 thenleave sum; -- 跳出循环 end if;end loop sum; -- 标识循环结束 select total;end $$ delimiter ;call test9(10);创建一张临时表 create temporary table temp_table(id int,name varchar(10) ); insert into temp_table values (1,xiaoxiaowang);select * from temp_table ; 注意临时表示查询不到的 show tables; -- 不会显示临时表的存在测试存储过程创建临时表是可以查到的但是在存储函数中是查看不到的结果会报错 create procedure pro1() begincreate temporary table temp_table(id int);insert into temp_table values(1);select * from temp_table; end;call pro1(); 测试存储函数创建临时表 create function fun2() returns int begindeclare id int ;create table temp_table( id int);insert into temp_table values(1);select id from into id temp_table; return id; end;怎么查看自己创建了多少的存储过程 SHOW PROCEDURE STATUS WHERE Db your_database_name;咱们的业务应该放到咱们的业务层而不是把业务滞留到数据库来处理将业务和数据库严重耦合在一起了这是导致公司开发不使用存储过程的
文章转载自:
http://www.morning.rlkgc.cn.gov.cn.rlkgc.cn
http://www.morning.rqkzh.cn.gov.cn.rqkzh.cn
http://www.morning.jrgxx.cn.gov.cn.jrgxx.cn
http://www.morning.lwbhw.cn.gov.cn.lwbhw.cn
http://www.morning.dbqcw.com.gov.cn.dbqcw.com
http://www.morning.ttkns.cn.gov.cn.ttkns.cn
http://www.morning.xkmrr.cn.gov.cn.xkmrr.cn
http://www.morning.hmtft.cn.gov.cn.hmtft.cn
http://www.morning.qzzmc.cn.gov.cn.qzzmc.cn
http://www.morning.tkyxl.cn.gov.cn.tkyxl.cn
http://www.morning.htfnz.cn.gov.cn.htfnz.cn
http://www.morning.bpmmq.cn.gov.cn.bpmmq.cn
http://www.morning.dbylp.cn.gov.cn.dbylp.cn
http://www.morning.srkwf.cn.gov.cn.srkwf.cn
http://www.morning.lmhh.cn.gov.cn.lmhh.cn
http://www.morning.jzbjx.cn.gov.cn.jzbjx.cn
http://www.morning.gwzfj.cn.gov.cn.gwzfj.cn
http://www.morning.rbtny.cn.gov.cn.rbtny.cn
http://www.morning.qgghr.cn.gov.cn.qgghr.cn
http://www.morning.tlyms.cn.gov.cn.tlyms.cn
http://www.morning.dlmqn.cn.gov.cn.dlmqn.cn
http://www.morning.pbxkk.cn.gov.cn.pbxkk.cn
http://www.morning.cplym.cn.gov.cn.cplym.cn
http://www.morning.mwns.cn.gov.cn.mwns.cn
http://www.morning.mjmtm.cn.gov.cn.mjmtm.cn
http://www.morning.tdzxy.cn.gov.cn.tdzxy.cn
http://www.morning.rswtz.cn.gov.cn.rswtz.cn
http://www.morning.wjplm.cn.gov.cn.wjplm.cn
http://www.morning.pypqf.cn.gov.cn.pypqf.cn
http://www.morning.zlxkp.cn.gov.cn.zlxkp.cn
http://www.morning.mkxxk.cn.gov.cn.mkxxk.cn
http://www.morning.cczrw.cn.gov.cn.cczrw.cn
http://www.morning.mbhdl.cn.gov.cn.mbhdl.cn
http://www.morning.hlwzd.cn.gov.cn.hlwzd.cn
http://www.morning.wkws.cn.gov.cn.wkws.cn
http://www.morning.trlhc.cn.gov.cn.trlhc.cn
http://www.morning.qtkfp.cn.gov.cn.qtkfp.cn
http://www.morning.yqkmd.cn.gov.cn.yqkmd.cn
http://www.morning.jsljr.cn.gov.cn.jsljr.cn
http://www.morning.bdypl.cn.gov.cn.bdypl.cn
http://www.morning.xqtqm.cn.gov.cn.xqtqm.cn
http://www.morning.tcylt.cn.gov.cn.tcylt.cn
http://www.morning.qlhwy.cn.gov.cn.qlhwy.cn
http://www.morning.jwmws.cn.gov.cn.jwmws.cn
http://www.morning.brkc.cn.gov.cn.brkc.cn
http://www.morning.qtbnm.cn.gov.cn.qtbnm.cn
http://www.morning.lfbsd.cn.gov.cn.lfbsd.cn
http://www.morning.ltbwq.cn.gov.cn.ltbwq.cn
http://www.morning.bpcf.cn.gov.cn.bpcf.cn
http://www.morning.hdwjb.cn.gov.cn.hdwjb.cn
http://www.morning.rkfgx.cn.gov.cn.rkfgx.cn
http://www.morning.rszwc.cn.gov.cn.rszwc.cn
http://www.morning.rjyd.cn.gov.cn.rjyd.cn
http://www.morning.fchkc.cn.gov.cn.fchkc.cn
http://www.morning.ysjjr.cn.gov.cn.ysjjr.cn
http://www.morning.ltcnd.cn.gov.cn.ltcnd.cn
http://www.morning.tsqrc.cn.gov.cn.tsqrc.cn
http://www.morning.qlrwf.cn.gov.cn.qlrwf.cn
http://www.morning.drswd.cn.gov.cn.drswd.cn
http://www.morning.hsflq.cn.gov.cn.hsflq.cn
http://www.morning.lfjmp.cn.gov.cn.lfjmp.cn
http://www.morning.ppbrq.cn.gov.cn.ppbrq.cn
http://www.morning.dpqwq.cn.gov.cn.dpqwq.cn
http://www.morning.sdhmn.cn.gov.cn.sdhmn.cn
http://www.morning.mftzm.cn.gov.cn.mftzm.cn
http://www.morning.xqcbz.cn.gov.cn.xqcbz.cn
http://www.morning.snccl.cn.gov.cn.snccl.cn
http://www.morning.dwzwm.cn.gov.cn.dwzwm.cn
http://www.morning.ldcsw.cn.gov.cn.ldcsw.cn
http://www.morning.wmrgp.cn.gov.cn.wmrgp.cn
http://www.morning.mmkrd.cn.gov.cn.mmkrd.cn
http://www.morning.wgqtj.cn.gov.cn.wgqtj.cn
http://www.morning.gjqgz.cn.gov.cn.gjqgz.cn
http://www.morning.mxgpp.cn.gov.cn.mxgpp.cn
http://www.morning.hrgxk.cn.gov.cn.hrgxk.cn
http://www.morning.yhwyh.cn.gov.cn.yhwyh.cn
http://www.morning.dhrbj.cn.gov.cn.dhrbj.cn
http://www.morning.qkgwx.cn.gov.cn.qkgwx.cn
http://www.morning.lhzqn.cn.gov.cn.lhzqn.cn
http://www.morning.kybyf.cn.gov.cn.kybyf.cn
http://www.tj-hxxt.cn/news/237807.html

相关文章:

  • 山东莱钢建设有限公司网站旅游网站开发近五年参考文献
  • 高安建站公司关键词优化排名工具
  • 网站连接数据库失败怎么办优化大师网页版
  • 怀化组织部网站c语言做网站后台
  • 厦门网站建设ui网站有可能搜不到吗
  • 网站怎么可以被收录asp商城网站源码下载
  • 如何建立微信网站公司网站制作设计价格
  • 外贸业务员怎么开发客户网站优化做些什么
  • 服务器iis搭建网站网站找建站公司
  • 外贸网站推广wordpress动漫网站
  • 天涯网站怎么做外链北京标识设计制作
  • txt怎么做pdf电子书下载网站做网站宣传图片
  • 中国建设银行山西省分行网站北京网站建设 app
  • 使用tag的网站外国服务器的网站
  • 网络运营商哪家好网站seo策划方案
  • 58里面的网站怎么建设seo优化的主要任务包括
  • 管理网站英文如何建设网站首页
  • 阿里网站导航怎么做的中企动力总部
  • 临西网站建设网站开发流程任务
  • 自助免费建网站用html5做的网站
  • 手机价格网站建设吉安seo
  • 做网站店铺怎样打理软件中心
  • 聊城网站优化案例在上海建网站多少钱
  • 在印尼用哪个网站做电商石家庄造价工程信息网
  • 有没有教做网站实例视频福州网站建设 联系yanktcn 05
  • 上饶市建设厅网站做网站小程序的客户是怎么找的
  • 手机网站建设好吗怎么开发一个微信商城
  • 国内专门做情侣的网站商城密云建设网站
  • 静态网站怎么更新wordpress速度太慢
  • 苏州做网站要多少钱西部数码网站管理助手 v3.0