Topic
  • 1 reply
  • Latest Post - ‏2014-07-10T21:48:38Z by Arun Ramamurthy
TarakN
TarakN
12 Posts

Pinned topic DBQuery using multiple SQL statements

‏2014-07-10T05:01:11Z |

Hello All,

My requirement is i need to execute multiple SQL staements in one DBQuery function. Can I do that.

I am having some 20 SQL statements which i need to execute in one DB query when i wrote the function it is not giving expected results. I tried another way also by writing 20 SQL statements and working fine but my worry is map is executing 20 times and connecting DB all the 20 times and their might be a performance issue.

Could someone throw a light on this.

 

Regards,

Tarak.

 

 

 

  • Arun Ramamurthy
    Arun Ramamurthy
    53 Posts

    Re: DBQuery using multiple SQL statements

    ‏2014-07-10T21:48:38Z  

    You could try something as below:

    Dblookup(
    Begin
    <SQL_stmnt1>;
    <SQL_Stmnt2>;
    End;
    ,
    "-MDQ <MDQ> -DBNAME <dbname> " )

    example:

    VALID(

         DBLOOKUP("Begin insert into <table1> values(a,b);insert into tabl2 values(a,b); end;" ,"-MDQ <mdqname> -DBNAME <dbname> -T")

            ,FAIL("DB failed"))

     

    This may work depending on the driver I guess , not sure. Also I am not sure if this would work for select statements.

    Or you could try putting all the sql statements in a stored procedure and call the stored procedure from the WTX map rule.