开发者

Use PHP and oci_bind_by_name to pass a list of values to Oracle

开发者 https://www.devze.com 2023-02-10 21:54 出处:网络
I have a list of numbers I wish to bind or pass to this Oracle SQL query. SELECT ad.lastname, ad.name, a开发者_StackOverflow中文版.cc cc, sum(a.qt) qt

I have a list of numbers I wish to bind or pass to this Oracle SQL query.

SELECT
    ad.lastname, ad.name, a开发者_StackOverflow中文版.cc cc, sum(a.qt) qt
FROM a, ad
  where ( ad.ci in (:idList) or (:idList is null)) 
  and ad.ci (+) = a.ci
  And A.Type = 'R'
  And A.Cc In ('SIDI','SIND','RSU')

Is it allowable to use the command oci_bind_by_name to bind :idList with a string containing a list of Ids? Could be seen as a string that seralizes the Ids?

Example:

It seems unfeasible "just" because the serialized list is not part of SQL syntax. Any ideas to reach my goal?


You can't do this with a string (unless you want to tokenize your id list with SQL).

oci_bind_by_name requires a string in this case.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号