Oracle 多参数查询语句
废话不多说了,直接给大家贴代码了,具体代码如下所示:
CREATEORREPLACEFUNCTIONf_get_param( IN_PARAMINVARCHAR2, IN_FLAGINVARCHAR2) RETURNVARCHAR2IS RESULTVARCHAR2(500); v_lengNUMBER; v_leftNUMBER; v_rightNUMBER; v_paramVARCHAR2(200); v_param1VARCHAR2(200); BEGION RESULT:=''; v_param:=IN_PARAM; v_leng:=LENGTH(v_param); v_left:=instr(v_param,in_flag); IFv_left>0THEN v_param1:=substr(v_param,v_left,v_leng-v_left+1) v_left:=instr(v_param1,':')+1; v_right:=indtr(v_param1,'$'); RESULT:=substr(v_param1,v_left,v_right-v_left) ENDIF; RETURN(RESULT); EXCEPTION WHENOTHERSTHEN RETURN''; ENDf_get_param; //数据库赋值格式 f_get_param(v_param,'materialtype:');//器件编码类型 //数据库展示 publicstringBuildToParams(ListArgsArgs) { stringparams='$'; if(Args!=null) { if(!string.isNotEmpty(Args.MaterailType)) { params=params+'materialtypes:'+Args.MaterailType+'$'; } } returnparams; } //Oracle数据库拓展-多选参数 SELECTinstr(','||'1,2,3,21'||',',','||'1'||',')FROMDUAL SELECT*FROMtable_namewhereinstr(','||list_id||',',','||id||',')>0 //Oarcle多条件','隔开查询 selectdistinctregexp_substr('我爱你','[^.]+',1,rownum)xyz_nameFromdual connectbyrownum<=length('我爱你')-length(replace('我爱你',','))+1
以上所述是小编给大家介绍的Oracle多参数查询语句,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!