Declaration of multiple values in Oracle BIND Variables

后端 未结 6 1918
庸人自扰
庸人自扰 2021-01-14 11:49

I am trying to pass multiple values about 3000 values, to a BIND variable in Oracle SQL PLUS command prompt like..

SELECT JOB
  FROM EMP 
 WHERE JOB IN :JOB          


        
6条回答
  •  爱一瞬间的悲伤
    2021-01-14 12:06

    Our team just ran into this issue and this query is very clean to pass multiple state values. Each value is separated by comma only. I can pass all 52 states if required:

    SELECT county_code,state_code FROM WMS__ASSET_COUNTY_STATE 
    WHERE STATE_CODE IN
    (SELECT regexp_substr(:bindstateocde, '[^,]+', 1, LEVEL) token
                FROM dual
                CONNECT BY LEVEL <= length(:bindstateocde) - length(REPLACE(:bindstateocde, ',', '')) + 1) ;
    

提交回复
热议问题