废话不多说了,直接给大家贴代码了,具体代码如下所示:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
CREATE OR REPLACE FUNCTION f_get_param(
IN_PARAM IN VARCHAR2,
IN_FLAG IN VARCHAR2)
RETURN VARCHAR2 IS
RESULT VARCHAR2(500);
v_leng NUMBER;
v_left NUMBER;
v_right NUMBER;
v_param VARCHAR2(200);
v_param1 VARCHAR2(200);
BEGION
RESULT := '' ;
v_param:=IN_PARAM;
v_leng := LENGTH(v_param);
v_left := instr(v_param,in_flag);
IF v_left > 0 THEN
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)
END IF;
RETURN (RESULT);
EXCEPTION
WHEN OTHERS THEN
RETURN '' ;
END f_get_param;
//数据库赋值格式
f_get_param(v_param, 'materialtype:' );//器件编码类型
//数据库展示
public string BuildToParams(ListArgs Args)
{
string params = '$' ;
if(Args != null )
{
if(!string.isNotEmpty(Args.MaterailType))
{
params = params + 'materialtypes:' + Args.MaterailType + '$' ;
}
}
return params;
}
//Oracle 数据库拓展-多选参数
SELECT instr( ',' || '1,2,3,21' || ',' , ',' || '1' || ',' ) FROM DUAL
SELECT * FROM table_name where instr( ',' || list_id || ',' , ',' || id || ',' ) > 0
//Oarcle 多条件 ',' 隔开查询
select distinct regexp_substr( '我爱你' , '[^.]+' ,1,rownum) xyz_name From dual
connect by rownum <= length( '我爱你' ) - length( replace ( '我爱你' , ',' )) + 1
|
以上所述是小编给大家介绍的Oracle 多参数查询语句,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!