Constant value feeding to SQL function

Hi,

I am new to DI and i have a question regarding SQL function, My requrement is in my SQL function i have to pass the value like ‘150%’ in the where clause, i am able to pass value like 150% with out the single quotes, but in my data base the value stored is like this ‘150%’, so can any any one explain me how to pass the value to the where clause in sql function with single quotes.
ex: sql( ‘SQL_DS’, 'SELECT VAL FROM ETL_TBL WHERE PROCESS_ID = ‘150%’ ');
it is going to submit to the Data base like this

SELECT VAL FROM ETL_TBL WHERE PROCESS_ID = 150%;

But i want the sql like this

SELECT VAL FROM ETL_TBL WHERE PROCESS_ID = ‘150%’;

can any one tell me how to come across this issue,

Thanks In Advance.

Regards,
Keerthi


keerthivemula (BOB member since 2009-10-12)

the following is correct
sql( ‘SQL_DS’, 'SELECT VAL FROM ETL_TBL WHERE PROCESS_ID = ‘150%’ ');

you can also use a variable and use that in sql() as below
$S_FILTER=‘150%’;
sql( ‘SQL_DS’, ‘SELECT VAL FROM ETL_TBL WHERE PROCESS_ID = {$S_FILTER}’);

if you are using % as wild card then you may have to use LIKE operator instead of =


manoj_d (BOB member since 2009-01-02)

Thanks Manoj


keerthivemula (BOB member since 2009-10-12)