zoukankan      html  css  js  c++  java
  • 如何执行oracle存储过程,就exec一下?

    不单单是exec一下,还是得分情况:

    1.如果是命令窗口就用exec 存储过程名,举个栗子:

    EXEC  procedure;--procedure是存储过程名
    

     2.如果是PL/SQL窗口就用 begin  存储过程名  end; 举个栗子:

    begin
      procedure;--procedure是存储过程名
    end;
    

     3.如果是程序中调用就用 call 存储过程名 ,举个栗子:

    hibernateDao.excuteSqlUpdate("{Call proc_stuInfo()}");//存储过程proc_stuInfo


    另附 存储过程创建方法:

    create or replace procedure pro_test--pro_test为存储过程名
    is
    temp varchar2(128);--temp为存储过程临时变量
    bengin
        select count(*) into temp from TEST;--这里为什么会使用temp变量,下面会提到
        insert into TEST values(3,'sss',25,'asd');
        commit;--切记commit一下(提交)
    end;

    注意:在存储过程中是不能直接出现"select * from test",这种简单查询,必须将查询出来的数据放入存储过程变量中,如上所示的temp变量。

  • 相关阅读:
    数据库设计——多表之间的关系
    约束
    DQL
    DML
    DDL
    Mysql——基础
    IT大牛关注链接
    deepin20安装Python3.85
    Python中的模块
    python中的装饰器
  • 原文地址:https://www.cnblogs.com/sdd53home/p/5169046.html
Copyright © 2011-2022 走看看