Using string in Oracle stored procedure

后端 未结 2 657
遥遥无期
遥遥无期 2021-01-27 00:56

When I simply write a query in which it has code like

Select * from ..
where ...
AND    gfcid in ( select regexp_substr(\'1005771621,1001035181\'||\',\',\'\\d+\'         


        
2条回答
  •  花落未央
    2021-01-27 01:36

    In general you can use

    execute immediate v_your_sql_code;

    to execute dynamic SQL within PL/SQL, but from your question I'm not really aware what you want to do.

    Edit:

    y_your_sql_code := 'Select yourColumn from ..  where ...AND  gfcid in ('||GDFCID_STRING||')';
    
    execute immediate v_your_sql_code into v_result;
    

    You'll have to define v_result in the right datatype, you could use more then one result variable if you need more result columns, you'll need i.e. a complex type if you can retrieve more than one row.

提交回复
热议问题