posts - 20,comments - 6,trackbacks - 0
frame锚点静态chm书/Files/spiritahead/frame.rar
posted @ 2010-02-02 16:31 Johnhe 阅读(224) | 评论 (0)编辑 收藏
System.out.println("-------------2----------"+uuid);
    
if(flag == 1){
        String url_success
="wangdian_extend_update.jsp?dwdm="+dwdm+"&wxyid="+wxyid+"&uuid="+uuid;
        out.println(
"<script>window.setTimeout(\"window.location='"+url_success+"'\",10)</script>");
    }
else{
        out.println(
"添加失败!");
        String url_fail
="wangdian_extend.jsp?dwdm="+dwdm+"&wxyid="+wxyid;
        out.println(
"<script>window.setTimeout(\"window.location='"+url_fail+"'\",10)</script>");
    }
posted @ 2009-07-02 18:02 Johnhe 阅读(154) | 评论 (0)编辑 收藏
<table align="center" width="640">
    
<tr >
        
<td>
            对应网点:
&nbsp;&nbsp;&nbsp;&nbsp;
            
<select name="wangdian" id="wangdian" style="width:80pt;" onchange="window.location='/safety-wxy/ent/wangdian_extend_update.jsp?dwdm=<%=dwdm%>&wxyid=<%=wxyid%>&uuid='+this.value;">
            <option value="0"></option>
            
<%
                String oid 
= "";
                String wdname 
= "";

                Connection connection;
                
try
                
{
                    connection 
= DataFactory.getConnection("wxyinfor");
                }

                
catch(Exception e)
                
{
                    
throw new SQLException(e.toString());
                }

                
                Statement statement
=null;
                ResultSet resultset
=null;
                
//System.out.println("--------"+uuid);
                String sql = "select oid,wdname,wdaddress,wdfzr,wdlxdh from T_xzwdext where dwdm = '"+dwdm+"' and wxyid = '"+wxyid+"'";
                System.out.println(
"----test sql ---"+sql);

                
try
                
{
                    statement 
= connection.createStatement();

                    
//resultset = statement.executeUpdate(sql);
                    resultset=statement.executeQuery(sql);

                    
while (resultset.next()) 
                    
{
                        
//oid = resultset.getString("oid");
            %>

            
<option value="<%=resultset.getString("oid") %>"><%=resultset.getString("wdname"%></option>
            
<%
                
//wdname = resultset.getString("wdname");
                
            }
   
    }

    
catch(Exception e)
    
{
        System.out.println(e.getMessage());
    }

    
finally
    
{
        
try
        
{
            
if(null!=resultset)
            
{
                resultset.close();
                resultset 
= null;
            }

        }
catch(SQLException e1){}

        
try
        
{
            
if(null!=statement)
            
{
                statement.close();
                statement 
= null;
            }

        }

        
catch(SQLException e2){}

        
try
        
{
            
if(null!=connection)
            
{
                connection.close();
                connection 
= null;
            }

        }

        
catch(SQLException e3){}    
    }

    
            
%>

            
<%
                System.out.println(usertype);    
                
if(usertype!=null & !"adm".equals(usertype)){
            
%>
                    
<input name="wadd" type="button" id="wadd"
                        value
="添加网点" onclick="window.location='/safety-wxy/ent/wangdian_extend.jsp?dwdm=<%=dwdm%>&wxyid=<%=wxyid%>'">
            
<%
                }

            
%>
        
        
</td>
    
</tr>
</table>
posted @ 2009-07-02 15:07 Johnhe 阅读(150) | 评论 (0)编辑 收藏
<select name="wangdian" id="wangdian" style="width:80pt;" onchange="window.location='/safety-wxy/ent/wangdian_extend_update.jsp?dwdm=<%=dwdm%>&wxyid=<%=wxyid%>&uuid='+this.value;">
解决onchange时候 获得value的值
posted @ 2009-06-25 16:28 Johnhe 阅读(179) | 评论 (0)编辑 收藏

怎么取得oracle里面的时分秒
取得当前时间的时分秒

select to_char(sysdate,'yyyymmdd hh24:mi:ss'from dual
select substr(to_char(sysdate,'yyyymmdd hh24:mi:ss'),10,2 )from dual
select substr(to_char(sysdate,'yyyymmdd hh24:mi:ss'),13,2 )from dual
select substr(to_char(sysdate,'yyyymmdd hh24:mi:ss'),16,2 )from dual

可以试试看这玩意
不知道是否有问题?

posted @ 2009-05-18 17:25 Johnhe 阅读(4894) | 评论 (0)编辑 收藏
public static String isNull(Object obj){
    
if(null == obj || ((String)obj).equals("")||obj.equals("null")||obj.equals("NULL")){
            
return "" ;
        }

        
return (String)obj;
    }
posted @ 2009-05-15 09:41 Johnhe 阅读(177) | 评论 (0)编辑 收藏

1.sql语句中between and 是闭区间[],支持日期的
2.oracle中日期查询的时候 要加上单引号
3.oracle是对大小写敏感的where ename='smith'和where ename='SMITH'是不一样的
4.like模糊查询%可以匹配任意长度 _可以匹配一个长度的内容
5.oracle中varchar2用模糊查询的时候一个字母和一个汉字 都是用一个下划线来匹配的
6.select upper('smith') from dual
  select * from emp where ename = upper('smith')
  lower()小写
  initcap()把第一个小写字母变化成大写
7.select contact('a','b') from dual建议使用||
8.select substr('hello',1,3)-------------substr在oracle中从0和1开始没有区别。select substr('hello',0,3)
  select length('hello')
  select replace('hello','l','x')
  select substr('hello',-3) from dual------------llo
  select substr('hello',-1,3) from dual -------------o
9.oracle中----日期-(+)数字=日期
   ----日期-日期=数字(天数)
  months_between() add_months() next_day() last_day()
10.♂select empno,ename,to_char(hiredate,'yyyy')year,to_char(hiredate,'mm')month,
     to_char(hiredate,'dd')day from emp
     to_char()----------可以拆分
   ♂select empno,ename,to_char(hiredate,'yyyy-mm-dd')year from emp
     select empno,ename,to_char(hiredate,'fmyyyy-mm-dd')year from emp--去掉前导的0
   ♂to_char()可以用在日期上也可以用在数字上
     select empno,ename,to_char(sal,'99,999')year from emp
     select empno,ename,to_char(sal,'$99,999')year from emp
     select empno,ename,to_char(sal,'L99,999')year from emp
11. select ename,nvl(comm,0),(nvl(sal,0)+nvl(comm,0)) from emp
    nvl()函数可以把null的值 变成 0
12. decode()函数
    select decode(1,1,'内容1',2,'内容2',3,'内容3') from dual-----内容1
    select decode(3,1,'内容1',2,'内容2',3,'内容3') from dual-----内容3
    decode函数类似if else
************************************************************************************************************
    select empno 雇员编号,ename 雇员姓名,hiredate 雇佣日期,
    decode(job,'CLERK','业务员','SALESMAN','销售人员','MANAGER','经理','ANALYST','分析','PRESIDENT','总裁') 职位
    from emp
    这里会把job这个字段里对应的相应的类似用ifelse转换为你想要的结果
************************************************************************************************************
13.不能用别名来作为where条件的select ename from emp where ename = 'SMITH'---RIGHT
         select ename e from emp where e = 'SMITH'--WRONG
14. select ename,
    trunc(months_between(sysdate,hiredate)/12)year,
    trunc(mod(months_between(sysdate,hiredate),12)) month,
    trunc(mod(sysdate-hiredate,30))day
    from emp
    这个计算了 到当前时间为止 某个人工作时间 大概
15. 查出雇员表中雇员的名字以及领导的名字
    ---->select e.ename 雇员名字,p.ename 另一个雇员名字
         from emp e,emp p
         这里做出笛卡尔积,自己做一下 看下效果就会即刻明白.不要去想为什么这样.
    ---->过滤
  select e.ename 雇员名字,p.ename 另一个雇员名字
  from emp e,emp p
  where e.mgr = p.empno

16. 查询除每个雇员的姓名,工资,部门名称,工资在公司的等级 及其领导的姓名以及工资所在公司的等级
    ----->先查出来每个雇员的姓名,工资,部门名称,工资在公司的等级
   select e.ename 雇员名称,e.sal 雇员薪水,d.dname 部门名称,s.grade 工资等级
          from emp e,salgrade s,dept d
          where e.sal between losal and hisal and e.deptno = d.deptno
    ----->再查 每个雇员的 领导名字
          select e.ename 雇员名称,e.sal 雇员薪水,
                 d.dname 部门名称,s.grade 工资等级,
                 p.ename 雇员领导
   from emp e,salgrade s,dept d,emp p
   where e.sal between losal and hisal
                and e.deptno = d.deptno
                and e.mgr = p.empno
    ---->再查 每个领导的工资等级
         select e.ename 雇员名称,e.sal 雇员薪水,
                 d.dname 部门名称,s.grade 工资等级,
                 p.ename 雇员领导,ls.grade 领导工资等级
   from emp e,salgrade s,dept d,emp p,salgrade ls
   where e.sal between s.losal and s.hisal
                and e.deptno = d.deptno
                and e.mgr = p.empno
                and p.sal between ls.losal and ls.hisal
    ---->优化
         select e.ename 雇员名称,e.sal 雇员薪水,
                 d.dname 部门名称,
   decode(s.grade,1,'第五等级',2,'第四等级',3,'第三等级',4,'第二等级',5,'第一等级') 工资等级,
                 p.ename 雇员领导,
   decode(ls.grade,1,'第五等级',2,'第四等级',3,'第三等级',4,'第二等级',5,'第一等级') 领导工资等级
   from emp e,salgrade s,dept d,emp p,salgrade ls
   where e.sal between s.losal and s.hisal
                and e.deptno = d.deptno
                and e.mgr = p.empno
                and p.sal between ls.losal and ls.hisal
17. 左右链接
    左连接表示 左边表中所有的字段都会列出来.但是右边没有的以空显示
    右连接表示 右边表中所有的字段都会列出来.但是左边没有的以空显示
18. sql1999语法
19. 组函数
     count(),max(),min(),avg(),sum()
    分组统计------------->
            group by 和 having 可以连用的
    select e.deptno,d.dname,avg(e.sal)
    from emp e,dept d
    where e.deptno = d.deptno
    group by e.deptno,d.dname having avg(e.sal)>2000
20. 显示出非销售人员工作名称以及从事同一工作雇员的月工资的总和。并且要满足
    从事同一工作的雇员的月工资合计大于5000,输出结果按月工资的合计统计
    ---->先显示全部的非销售人员
         select ename,job from emp where job<>'SALESMAN'
    ---->按工作分组,同时求出工资的总和
         select job,sum(sal) from emp where job<>'SALESMAN' group by job
    ---->月工资>5000
         select job,sum(sal) from emp where job<>'SALESMAN' group by job having sum(sal)>5000
    ---->排序
         select job,sum(sal) s from emp where job<>'SALESMAN' group by job having sum(sal)>5000 order by s
21. 求出平均工资最高的部门
    select deptno,max(avg(sal)) from emp group by deptno-------错误
    select max(avg(sal)) from emp group by deptno-----正确
22. 子查询
    ---->查询比7654工资高的雇员信息
         select * from emp where sal > (select sal from emp where empno=7654)
    ---->查询比7654工资高的雇员信息,与7788从事相同工作的全部雇员信息
  -->先查询7654的工资select sal from emp where empno = 7654
         -->再查询 同时7788工作select job from emp where empno = 7788
  -->综合select * from emp where sal > (select sal from emp where empno = 7654)
         and  job = (select job from emp where empno = 7788)
    ---->查询工资最低的雇员的姓名,工作工资
         -->先查出最低工资select min(sal) from emp
  -->select ename,job,sal from emp where sal = (select min(sal) from emp)
    ---->查询部门名称,部门的员工数,部门的平均工资,部门的最低收入雇员的姓名(这个语句只是适合一个最低工资不一样的)
  select e.deptno,count(sal),avg(sal),d.dname from emp e ,dept d where e.deptno = d.deptno
  group by e.deptno,d.dname
         -->select deptno,count(sal) c,avg(sal) from emp group by deptno
         -->select d.dname,ed.c,ed.a from dept d,(select deptno,count(sal) c,avg(sal) a from emp group by deptno) ed where d.deptno = ed.deptno
  -->select d.dname,ed.c,ed.a ,ed.min,e.ename from
     dept d,
     (select deptno,count(sal) c,avg(sal) a,min(sal) min from emp group by deptno) ed ,
     emp e
     where d.deptno = ed.deptno
     and e.sal = ed.min
23. 子查询中的IN
    ->查询每个部门的最低工资的雇员信息
    ---->select * from emp where sal in(select min(sal) from emp group by deptno)
24. create table myemp as select * from emp
    这个语句保存了emp表的原始信息会将表结构和数据完整的复制出来
    这个操作不会把约束带进来的。


    to_date('String','yyyy-mm-dd')
    create table myemp as select * from emp where empno=10表示只是包含10部门雇员的一张临时表
25. 在oracle中每一个链接到数据库的窗口,都会建立与数据库的一个session
    一个session如果更新了数据库中的记录,其他session是无法更新的要等待对方提交之后才允许更新。一种死锁的概念

 
    select * from tab;
    select * from tab where tname = '';

26. select * from (select rownum rn,ename,job,sal,hiredate from emp where rownum<=10) e where e.rn>5分页

27. a.创建用户:create user test identified by test(要创建用户必须使用管理员用户sys)
    没有session的权限无法登陆的ora-01045,解决办法授权grant
    grant create session to test--->将创建session的权限给test用户
    ****************************************这个时候使用test用户登陆成功的话,表示创建了一个session
    b.一个新的用户所有的权限都要分别赋予,一个角色包含很多权限
    c.Oracle中connect,resource
    grant connect,resource to test--->这个时候 可以建表了
    d.超级管理员可以修改普通管理员密码alter user 用户名 identified by 密码
    e.alter user 用户名 pasword expire 让用户第一次密码失效 强制修改
    f.alter user 用户名 account lock 将用户锁住
    g.alter user 用户名 account unlock 解锁用户
28. 想访问其他用户的表,需要授予其他用户表的权限
    grant SELECT ,DELETE on scott.emp to test---将scott.emp查询和删除的权限给test用户
    回收权限
    revoke 权限 on 用户.表明 from 用户

posted @ 2009-05-11 09:14 Johnhe 阅读(355) | 评论 (0)编辑 收藏