Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2017
    Posts
    1

    Unanswered: Informix: Use wildcard in where condition query

    Hi,

    I'm using informix in Cisco Callmanager.

    if i run this query

    Code:
    admin:run sql SELECT dnorpattern AS number, numplan.description AS description, cfadestination AS call_fwd_destination, cfbdestination, cfnadestination, cfbintdestination, cfnaintdestination, pffdestination, pffintdestination, cfurdestination, cfurintdestination, callingsearchspace.name AS css FROM numplan JOIN callforwarddynamic ON numplan.pkid=callforwarddynamic.fknumplan JOIN callingsearchspace ON callingsearchspace.pkid=callforwarddynamic.fkcallingsearchspace_cfa where cfadestination like '%%875421%%'
    I get the following result

    Code:
    number description call_fwd_destination cfbdestination cfnadestination cfbintdestination cfnaintdestination pffdestination pffintdestination cfurdestination cfurintdestination css
    ====== =========== ==================== ============== =============== ================= ================== ============== ================= =============== ================== ===========
    986532             1+875421             3+875421       5+875421        2+875421          4+875421           7+875421       6+875421          10+875421       9+875421           APP_CIC_FWD
    I would like to use a wildcard so instead of
    Code:
    where cfadestination like
    i would have
    Code:
    where %%destination like
    so the condition can apply for any of the column.

    I could do
    Code:
    run sql SELECT dnorpattern AS number, numplan.description AS description, cfadestination AS call_fwd_destination, cfbdestination, cfnadestination, cfbintdestination, cfnaintdestination, pffdestination, pffintdestination, cfurdestination, cfurintdestination, callingsearchspace.name AS css FROM numplan JOIN callforwarddynamic ON numplan.pkid=callforwarddynamic.fknumplan JOIN callingsearchspace ON callingsearchspace.pkid=callforwarddynamic.fkcallingsearchspace_cfa where cfadestination like '%%875421%%' OR cfbdestination like '%%875421%%' OR cfnadestination like '%%875421%%' OR cfbintdestination like '%%875421%%' OR cfnaintdestination like '%%875421%%' OR pffdestination like '%%875421%%' OR pffintdestination like '%%875421%%' OR cfurdestination like '%%875421%%' OR cfurintdestination like '%%875421%%'
    but then how could i replace '%%875421%%' to a variable?

    many thanks

  2. #2
    Join Date
    Sep 2011
    Location
    Pont l'Abbé, Brittany, France
    Posts
    391
    Provided Answers: 1
    what you wanna do is to build a PREPARED query using variables binding. Any language that connects to Informix can do that, but I do not know whether the Cisco front-end tool can do that

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •