需求:将如:16140737,16140833,16141055的字符串转换为'16140737','16140833','16141055' ,方便直接在sql语句里面拼装。

PL/SQL中:

            --交接单号列表格式转换,方便update:
            --如:16140737,16140833,16141055--》'16140737','16140833','16141055'
            --交接单号存在的时候才更新
            if (v_handovernos is not null and length(v_handovernos) > 0) then

             --将字符串中的逗号【,】替换为【','】,在前后加单引号!
              v_handovernos := '''' || replace(v_handovernos, ',', ''',''') || '''';
              --更新交接单相关信息sql
              v_updatesql := 'update t_ope_handoverbill t
                 set t.funloadman      = v_unloadman,
                     t.funloadtime     = v_unloadtime,
                     t.funloadovertime = unloadovertime
                 where t.fnumber in(' ||
                             v_handovernos || ')';
              --执行更新操作    
              execute immediate v_updatesql;