how to use like in a select.(oracledb), the below sql does not work as expected, how do i pass some thing like '%$provider_id%'
SELECT * FROM PROVIDER where provider_id like $provider_id
, xml shows as
-<sql_query>
<statement>SELECT * FROM PROVIDER where provider_id like ? </statement>
-<params>
<param position="1" type="string" value="1"/>
</params>
</sql_query>
SELECT * FROM PROVIDER where provider_id like $provider_id
, xml shows as
-<sql_query>
<statement>SELECT * FROM PROVIDER where provider_id like ? </statement>
-<params>
<param position="1" type="string" value="1"/>
</params>
</sql_query>
RE: sql parameters.
The SQL statement ? parameters are substituted with the parameters defined by the xpath match.
In the majority of situations a simple xpath match is enough to provide the correct value.
However, if you need to use SQL wildcard characters in a parameter, then it is necessary to use an xpath concat function.
SQL has the % (percent) and _ (underscore) wildcard characters that can be used at the beginning, end and/or middle of a text value.
So, the concat xpath function allows you to join various string, wildcard and xpath values together to form the wildcard search parameter you need. In fact the xpath concat function can even have nested xpath functions such as substring of an xpath value.
The param value in this case would be something like:
concat('%',/YOUR XPATH TO VALUE OF provider_id,'%')