- 浏览: 176140 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (321)
- eclipse (4)
- idea (2)
- Html (8)
- Css (14)
- Javascript (8)
- Jquery (6)
- Ajax Json (4)
- Bootstrap (0)
- EasyUI (0)
- Layui (0)
- 数据结构 (0)
- Java (46)
- DesPattern (24)
- Algorithm (2)
- Jdbc (8)
- Jsp servlet (13)
- Struts2 (17)
- Hibernate (11)
- Spring (5)
- S2SH (1)
- SpringMVC (4)
- SpringBoot (11)
- WebService CXF (4)
- Poi (2)
- JFreeChart (0)
- Shiro (6)
- Lucene (5)
- ElasticSearch (0)
- JMS ActiveMQ (3)
- HttpClient (5)
- Activiti (0)
- SpringCloud (11)
- Dubbo (6)
- Docker (0)
- MySQL (27)
- Oracle (18)
- Redis (5)
- Mybatis (11)
- SSM (1)
- CentOS (10)
- Ant (2)
- Maven (4)
- Log4j (7)
- XML (5)
最新评论
1. oracle函数
2. oracle存储过程
3. oracle存储过程debug
create function 函数名称 return 返回值类型 as begin ... end 函数名称; 查询t_book表的count数 SQL> create function getBookCount return number as begin declare book_count number; begin select count(*) into book_count from t_book; return book_count; end; end getBookCount; SQL> set serveroutput on; begin dbms_output.put_line('表t_book有'|| getBookCount() ||'条数据'); end; 运行结果: 表t_book有4条数据 查询任意表的count数 SQL> create function getTableCount(table_name varchar2) return number as begin declare recore_count number; query_sql varchar2(300); begin query_sql:='select count(*) from ' || table_name; execute immediate query_sql into recore_count; return recore_count; end; end getTableCount; SQL> begin dbms_output.put_line('表有'|| getTableCount('t_bookType') ||'条数据'); end; 运行结果: 表有2条数据
2. oracle存储过程
create procedure 存储过程名称 as begin ... end 存储过程名称; in只进不出 out只出不进 in out可进可出 增加book SQL> create procedure addBook(bookName in varchar2,typeId in number) as begin declare maxId number; begin select max(id) into maxId from t_book; insert into t_book values(maxId+1,bookName,typeId); commit; end; end addBook; SQL> execute addBook('java好东西',1); 增加book前判断重复 SQL> create procedure addBook2(bN in varchar2,typeId in number) as begin declare maxId number; n number; begin select count(*) into n from t_book where bookName=bN; if(n>0) then return; end if; select max(id) into maxId from t_book; insert into t_book values(maxId+1,bN,typeId); commit; end; end addBook2; SQL> execute addBook2('java好东西',1); SQL> execute addBook2('java好东西33',1); out只出不进示例 SQL> create procedure addBook3(bN in varchar2,typeId in number,n1 out number,n2 out number) as begin declare maxId number; n number; begin select count(*) into n1 from t_book; select count(*) into n from t_book where bookName=bN; if(n>0) then return; end if; select max(id) into maxId from t_book; insert into t_book values(maxId+1,bN,typeId); select count(*) into n2 from t_book; commit; end; end addBook3; SQL> declare n1 number; n2 number; begin addBook3('onlyInNotOut',2,n1,n2); dbms_output.put_line('n1='||n1); dbms_output.put_line('n2='||n2); end; 运行结果: n1=7 n2=8
3. oracle存储过程debug
debug调试 Procedure --> addBook2 --> 右键Add debug infomation --> 右键Test
发表评论
-
账户锁定:ORA-28000: the account is locked
2019-02-28 09:16 2091Caused by: java.sql.SQLExcept ... -
oracle中角色
2018-12-21 10:58 5661. oracle角色 角色是权限的集合,可以给用户直接分 ... -
oracle中权限
2018-12-21 10:12 5241. oracle权限 oracle权限分为系统权限和对象 ... -
oracle中用户
2018-12-21 09:53 5511. oracle用户 oracle用户分两种,一种是系统 ... -
oracle中程序包?
2018-12-21 09:40 6711. oracle程序包 引入的目的,是为了有效的管理函数 ... -
oracle中触发器
2018-12-20 15:29 5621. oracle触发器 ---------------- ... -
oracle中游标
2018-12-20 09:26 5581. oracle游标 1) 游标简介 使用游标,我们可 ... -
oracle中控制语句
2018-12-20 09:15 5721. oracle控制语句 set serverout o ... -
oracle中约束!
2018-12-19 16:26 5331. oracle约束 1.1 主键约束 primary ... -
oracle中视图
2018-12-19 09:25 5971. 用户授权 查看当前用户的角色 SQL> se ... -
oracle中数据类型及函数
2018-12-19 09:22 6261. 字符串类型及函数 ----------------- ... -
oracle中table表操作
2018-12-18 11:47 7311. scott用户示例表 1) 部门表:dept 1D ... -
oracle中sequence序列
2018-12-18 11:47 5781. oracle序列 ----------------- ... -
oracle中tablespace表空间
2018-12-18 11:47 6251. oracle表空间 一个数据库可以有多个表空间,一个 ... -
oracle软件sqldeveloper的安装
2018-12-18 11:46 6301. PLSQL Developer 10安装 1) PLS ... -
oracle软件oracle11g的安装
2018-12-18 11:46 6381. oracle的下载 oracle官 ... -
密码过期:ORA-28001: the password has expired
2018-12-24 15:48 11621. 密码过期:ORA-28001: the password ...
相关推荐
oracle笔记存储函数和存储过程,有具体的代码案例!存储函数和存储过程的知识笔记!
如何调用oracle的函数、存储过程
oracle 函数 oracle函数 存储过程
oracle 的函数、存储过程、游标、简单实例 oracle常用语句oracle 的函数、存储过程、游标、简单实例 oracle常用语句
Oracle中的函数、存储过程、包. 函数 ①系统函数 ②自定义函数 ③使用函数 ④编写过程 ⑤过程的调用
oracle函数大全与存储过程语法 ,有9I,10G的oracle函数和存储过程语法,
oracle函数调用存储过程.doc
oracle函数大全及存储过程语法 oracle函数大全及存储过程语法 oracle函数大全及存储过程语法 oracle函数大全及存储过程语法
里面包含了oracle中最基本的函数和存储过程的例子,可咦更加直观的学好函数和存储过程
你还在为如何调用oracle中的存储过程和函数而烦恼吗,请看看该文档。
Oracle常用Oracle、函数、存储过程[归类].pdf
ibatis调用oracle的函数,存储过程的方法,从网上收集的,还没有整理。
oracle 存储过程 函数 dblink 绝对对工作和平时学习有价值的资料。针对个人具体情况做修改即可使用
java调用oracle存储过程或者函数
oracle函数大全及存储过程语法 chm
oracle函数大全及存储过程语法.rar
Oracle存储过程、游标、函数的详解