我正在PLSQL中创建一个报告。
该报告工作正常,此外,当用户从一个以分隔的字段中搜索多个值时,我需要添加;
。它应该选择他输入的所有数据。
示例:推销员-阿曼达;米歇尔 沙曼
然后,它应该选择有关amenda,michelle和sharmain的数据。
我的代码仅返回一个值的数据。
请参考代码中的这一行 and ifsapp.Customer_Order_API.Get_Salesman_Code(i.order_no) LIKE '&Salesman'
where i.catalog_group='FPMB'
and i.order_no like 'M%'
and ((i.invoice_date between to_date( '&From_Date', 'YYYY/MM/DD' ) and to_date( '&To_Date', 'YYYY/MM/DD' ) ) or ('&From_Date' is null and '&To_Date' is null))
and t.source_ref1=i.order_no
and (t.source_ref3=i.release_no)
and (t.source_ref2=i.line_no)
and i.contract=t.contract
and t.transaction_code='OESHIP'
and t.qty_reversed=0
and t.source_ref1=i.order_no
and t.serial_no <> '*'
and t.cost<>0.00
and i.order_no LIKE '&Order_No
and ifsapp.Customer_Order_API.Get_Salesman_Code(i.order_no) LIKE '&Salesman'
你可以按如下方式使用层次结构查询:
ifsapp.Customer_Order_API.Get_Salesman_Code(i.order_no) IN
(SELECT TRIM(REGEXP_SUBSTR('&Salesman','[^;]+',1,LEVEL))
FROM DUAL CONNECT BY TRIM(REGEXP_SUBSTR('&Salesman','[^;]+',1,LEVEL)) IS NOT NULL)
嗨,Tejash,代码按我的意愿工作。谢谢..
很高兴知道这有所帮助。如果它解决了您的问题,则应将其标记为已接受,以便将该问题标记为已解决。