订单导入(常见问题和sql)
1.印章取行,有几行取几行
union select 'PARAM07' name,
case
when regexp_count(PO_PARAM_20, chr(10)) > 0 then
substr(PO_PARAM_20, 0, instr(PO_PARAM_20, chr(10)) - 1)
else
PO_PARAM_20
end value,PO_ID
from UTACGSLRS02_PO P
WHERE P.PO_ID = {0}
union
select 'PARAM08' name,
case
when regexp_count(PO_PARAM_20, chr(10)) = 1 then
substr(PO_PARAM_20, instr(PO_PARAM_20, chr(10), 1, 1) + 1)
when regexp_count(PO_PARAM_20, chr(10)) in (2, 3, 4) then
trim(substr(PO_PARAM_20,
instr(PO_PARAM_20, chr(10), 1, 1) + 1,
instr(PO_PARAM_20, chr(10), 1, 2) -
instr(PO_PARAM_20, chr(10), 1, 1) - 1))
else
'-'