Topic
  • 2 replies
  • Latest Post - ‏2012-05-22T13:12:55Z by SystemAdmin
SystemAdmin
SystemAdmin
783 Posts

Pinned topic dynamic query

‏2012-05-22T10:46:37Z |
can i use dynamic query in bds and how?

for exemple
for my step1:
bds1=> in getInitialLookupQuery methode i have ; query= "select distinct op.numCompte, op.codePops from TOperation op"

in my processJobStep methode i read the recorde from bds1 and i get 'numCompte' and 'codePops' witch i will use in my dynamique query of bds2

bds2=> getInitialLookupQuery methode: "select op from TOperation op where op.numCompt=" X+
"and op.codePops=" Y+

what X and Y will be ?
email:s.daouiji@gmail.com
Updated on 2012-05-22T13:12:55Z at 2012-05-22T13:12:55Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    783 Posts

    Re: dynamic query

    ‏2012-05-22T13:00:44Z  
    Well, yes, you could. There is no "out of the box" BDS to do that. You would have to implement your own BDS class by implementing the BatchDataStream interface. But the better question is why would you use a BDS for dynamic query? There are two reasons to use a BDS:

    1. You want a restartable stream. Since you are doing dynamic queries, there is no place to restart from. So a BDS does not make sense for that usage.
    2. You want to be able to swap implementations (e.g. unit test vs production) by simply modifying the xJCL. That might apply to your case.

    If neither of these reasons apply to your case, then I recommend you simply read from your primary BDS and then do your dynamic queries directly from your batch job step.
  • SystemAdmin
    SystemAdmin
    783 Posts

    Re: dynamic query

    ‏2012-05-22T13:12:55Z  
    Well, yes, you could. There is no "out of the box" BDS to do that. You would have to implement your own BDS class by implementing the BatchDataStream interface. But the better question is why would you use a BDS for dynamic query? There are two reasons to use a BDS:

    1. You want a restartable stream. Since you are doing dynamic queries, there is no place to restart from. So a BDS does not make sense for that usage.
    2. You want to be able to swap implementations (e.g. unit test vs production) by simply modifying the xJCL. That might apply to your case.

    If neither of these reasons apply to your case, then I recommend you simply read from your primary BDS and then do your dynamic queries directly from your batch job step.
    tnx for the reply
    that's so helpful :)

    email:s.daouiji@gmail.com