Wednesday, December 29, 2010

AppEngine:%bind()_Dynamic Where Clause :Single Quote Problem

I've requirement to prepare dynamic where cluses based on setup.

In Setup: PLAN_TYPE values are stored like this as string : '10','11','15'.

This string  needs to inserted into AET ; In SQL Action, passed value using %bind().
eg: In AET
SR_TEST_AET.DESCR = '10','11','15'

SQL Action:
Select * from PS_SR_TEST_REC where plan_type in (%bind(DESC)).

Internally this sql is expanding differently as below : 


Select * from PS_SR_TEST_REC where plan_type in (''''10'',''11'',''15'''') -  due to this i faced lot of problem.

Solution: to insert dynamic clasue:                                                                                                                 

Select * from PS_SR_TEST_REC where plan_type in (%bind(DESC),NOQUOTES);
 it solves my problem & it expands as required

Select * from PS_SR_TEST_REC where plan_type in ( '10','11','15').


^_^

1 comment:

sudeep said...

Hello Sreeni,

Nice to see that you are sharing your experince with others.

Thanks,
Sudeep