zoukankan      html  css  js  c++  java
  • 存储过程

    --存储过程(在数据库的可编程性里面)

    create proc chaxun
    as
    begin
     select *from student
    end
    go
    --执行
    exec chaxun
    --删除
    drop proc chaxun
    --修改
    alter proc chaxun
    as
    begin
     select *from hj
    end
    go

    /*=====================输入一个数,求这个数的阶乘的和=====================*/
    create proc jiechenghe
    @p int,@w int output,@h int output    --output导出参数时使用
    as
    begin
         declare @s int
         set @w=1
         set @s=1
         set @h=0
         while @s<=@p       --while 代表循环的意思
               begin
                 set @w=@s*@w
                 set @s=@s+1
                 set @h=@h+@w
               end
    end
    go
    declare @c int,@c1 int                --新建函数是为了导出参数使用的
    exec jiechenghe 6,@c output,@c1 output
    print @c             --print输出结果
    print @c1

    //return 也是导出参数但是只能导出一个参数且表达方式是int型的

  • 相关阅读:
    多态
    java8的十大新特性
    Floyd最短路径算法
    ES6(六)函数扩展
    ES6(五)数组扩展
    ES6(四)数值扩展
    ES6(一)解构赋值
    store封装
    ipad方案
    pyinstaller编译打包为pyd
  • 原文地址:https://www.cnblogs.com/2041388565m/p/4135749.html
Copyright © 2011-2022 走看看