廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:
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 多參數查詢語句,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時回復大家的!