- 浏览: 55651 次
-
最新评论
文章列表
oracle 带参数的存储过程
- 博客分类:
- oracle存储过程
/*
给指定的员工涨100的工资,并打印涨前和涨后的薪水
create [or replace] PROCEDURE 过程名(参数列表)
AS
PLSQL子程序体;
SQL> begin
2 raiseSalary(7839);
3 raiseSalary(7566);
4 commit;
5 end;
6 /
涨前:7986 涨后:8086
涨前:5024.53 涨后:5124.53
PL/SQL 过程已成功完成。
*/
create or replace procedure ...
/*
打印Hello World
create [or replace] PROCEDURE 过程名(参数列表)
AS
PLSQL子程序体;
调用存储过程:
1. exec sayHelloWorld();
2. begin
sayHelloWorld();
sayHelloWorld();
end;
/
*/
create or replace procedure sayHelloWorld
as
--declare
--变量说明
begin
dbms_output.put_line('Hello World');
end;
plsql实现统计员工入职年份人数
- 博客分类:
- plsql编程
--统计公司员工入职年份的员工数
declare
cursor p_cursor is select to_char(hiredate,'YYYY' ) from emp;
p_hiredate char(10);
count80 number:=0;
count81 number:=0;
count87 number:=0;
count82 number:=0;
begin
open p_cursor;
loop
fetch p_cursor into p_hiredate;
exit w ...
plsql自定义例外
- 博客分类:
- plsql编程
--自定义例外
declare
cursor p_scursor is select ename from emp where empno=50;
p_ename emp.ename%type;
--定义自定义的例外
no_empname_found exception;
begin
open p_scursor;
fetch p_scursor into p_ename;
if p_scursor%notfound then
raise no_empname_found;
end if;
close p_scur ...
--plsql异常的处理
declare
pnum number;
begin
pnum:=1/0;
exception
when Zero_Divide then
dbms_output.put_line('0不能被除。。。。。。。。。。。。。');
dbms_output.put_line('0不能被除。。。。。。。。。。。。。');
when Value_error then dbms_output.put_line('算数书屋。。。。。。。。');
when ...
--光标的使用
/*
光标的三个属性 1 notfound% isopen% rowcount%
*/
declare
--定义光标
cursor emp_cursor is select ename,sal from emp;
p_name emp.ename%type;
p_sal emp.sal%type;
begin
open emp_cursor;
loop
fetch emp_cursor into p_name,p_sal;
dbms_output.put_line(p_name||'的薪水是'||p_sal);
e ...
declare --声明变量
begin --开始
dbms_output.put_line('hello world'); --程序块
end; --结束
--plsql变量的声明
declare
myName char;
age number(8,2);
married boolean:=true;
ename emp.ename%type;
emp_rec emp%rowtype;
begin
dbms_output.put_line('hel ...
5、连接池的实现
为什么要有连接池
1:维护多个连接。必须要保证每一个线程获取到的是不同的connection对象。
2:提供一个方法可以回收连接。
以下是最基本的实现:
package cn.itcast.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;
public class ConnUtils2 {
//声明一个容器,放所有声明的连接Connection
private static List ...
sql语句
select to_char(t.duty_date, 'YYYY-MM-DD') as duty_date,
'441201008' as ORG_ID,
max(decode(t.site_no, '0144004212001', t.teller_no, null)) as a0144004212001,
max(decode(t.site_no, '0144004212002', t.teller_no, null)) as a0144004212002,
...
jsp.....
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix= ...
excel导出动态数据列表。。。
- 博客分类:
- java导出excel
/**
* 导出台账
*/
public ActionForward exportQues(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String orgId = request.getParameter("id_org");
String checkId = request.getParameter("checkId");
QueryF ...
前段jsp代码
<!-- 列表部分开始 -->
<table id="LodgeInfo" class="dataList" width="100%" cellspacing="0" border="0">
<!-- 表头 -->
<thead>
<tr>
<th width="3%"><input type="checkbox" ...
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DO ...
var comboxWithTree_sys = new Ext.form.ComboBox({
id:'comboxWithTree_sys',
labelAlign:'left',
fieldLabel:"所属层级",
//columnWidth:.33,
// labelWidth: 80,
hiddenName:'entity.cuseDept',
labelStyle : "text-align:right&qu ...
--统计各个部门各个年份的入职人数 --还有一个人不属于任何部门
select
e.department_id,
d.department_name,
count(*) total,
sum(decode(to_char(hire_date,'yyyy'),'2001',1,0)) "2001",
sum(decode(to_char(hire_date,'yyyy'),'2002',1,0)) "2002",
sum(decode(to_char(hire_date,'yyyy'),' ...