动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > Oracle教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Oracle教程 ]的信息

本月文章推荐
.Oracle收购TimesTen 提高数据库软.
.使用event api诊断数据导入imp性.
.全面剖析Oracle数据库中的分区功.
.oracle/sql server procedure 导.
.oracle的文本导入、导出技巧.
.Oracle中大对象(lob)处理方法和.
.ORACLE PL/SQL 基础.
.Oracle:如何对CLOB行字段执行全文.
.嵌套表和可变数组.
.java连接oracle,取io文件内容,.
.Fontconfig用户手册.
.在RHEL AS 3 上安装Oracle10g 参.
.大型数据库信息排错一法.
.Windows下如何彻底删除Oracle.
.前高管曝甲骨文内幕:走马换将渠.
.ext3格式下的quota的实现.
.如何在硬碟建置Linux系统之setup.
.Oracle或将收购Jboss? 相关各方.
.Oracle常用技巧和脚本.
.实例讲解如何更改字段至兼容的不.

使用Instr()与decode()进行多条件组合查询

发表日期:2008-2-9 |


    系统中碰到了要处理多条件组合查询的情况,好比说有4个独立的条件,那么组合出的查询条件便有24种,不可能写24条Sql语句再分别指定给24种组合情况吧,条件数再多点呢,人都会搞疯的。。。。于是我求助于高手,获得了使用instr()和decode()函数的实现方法。     下面先说明一下instr()的功能和语法:(函数的语法是从http://www.techonthenet.com/Oracle/functions/index.htm处得到的,相当清楚明了:)
In Oracle/PLSQL, the instr function returns the location of a substring in a string. The syntax for the instr function is: instr (string1, string2, [start_position], [nth_appearance]) string1 is the string to search. string2 is the substring to search for in string1. start_position is the position in string1 where the search will start.  This argument is optional.  If omitted, it defaults to 1.  The first position in the string is 1.  If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1. nth_appearance is the nth appearance of string2.  This is optional.  If omiited, it defaults to 1.
再说明一下decode()的功能和语法: In Oracle/PLSQL, the decode function has the functionality of an IF-THEN-ELSE statement. The syntax for the decode function is: decode ( eXPression , search , result [, search , result]... [, default] ) expression is the value to compare. search is the value that is compared against expression. result is the value returned, if expression is equal to search. default is optional.  If no matches are found, the decode will return default.  If default is omitted, then the decode statement will return null (if no matches are found). 综合使用得到的SQL语句如下: select e.到达日期,
       e.角色名,
       d.单据标题,
       d.单据编号,
       e.节点编号,
       e.处理动作,
       e.处理日期,
       b.流程实例编号   from gzl_流程类型     a,
       gzl_流程实例     b,
       gzl_流程定义     c,
       dj_单据          d,
       gzl_流程流转状态 e
 where a.流程类型编号 = c.流程类型编号 and e.处理标记 = '是'
       and   e.用户id = 'tetdmis' and b.流程定义编号 = c.流程定义编号    
       and b.活动编号 = d.单据编号 and c.流程定义编号 = b.流程定义编号
       and  e.流程实例编号 = b.流程实例编号
    
  and instr(decode(:流程类型条件, '-1', a.流程类型编号, :流程类型条件), a.流程类型编号) > 0
      and (to_char(e.处理日期, 'yyyy-mm-dd') between :开始日期 and :结束日期)      
       and instr(decode(:节点名称条件, '-1', e.处理动作, :节点名称条件),
                 e.处理动作) > 0
上一篇:Oracle XML学习笔记-存储XML数据 人气:652
下一篇:系统对象IDL_UB1$表的含义及作用 人气:550
浏览全部Oracle教程的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-10-10 企业网站智能管理系统(TZIMS) v6
2008-10-10 拓文asp.net网站内容管理系统 v6
2008-10-10 动网论坛PHP版 v2.0++ Build 081
2008-10-10 免费时代CMS v5.0
2008-10-10 wodig第四季中文DIGG社区 v4.1 b
2008-10-10 老Y文章管理系统 v2.2 bulid 081
2008-10-10 魔法盒动感相册 ASP+SQL版 v2.0
2008-10-10 Asoft签到管理系统 v3.0 Pack1
2008-10-10 哥特人音乐网潮流留言本 v1.1
2008-10-11 联系人分组工具 v1.1 中文破解版
2008-10-11 FaceMelter变脸 v2.0 汉化破解版
2008-10-11 PathTracker道路跟踪仪 v1.2 破解
2008-10-11 Rooms手机聊天室 v0.6.7 破解版
2008-10-11 RemoteDesktop远程桌面 v1.0 破解
2008-10-11 ProRemote远程调音台 v1.0.1 破解
2008-10-11 PicShare照片共享 v1.0.0 破解版
2008-10-11 Photogene照片编辑器 v1.5 汉化破
2008-10-11 WriteRoom共享文档 v1.0 破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵
SEO対策 中国語教室 ホームページ作成