Dashboard > iBATIS DataMapper > Home > Frequently Asked Questions > How do I execute multiple SQL statements at one time with Oracle?
  funny mexican memes memes in spanish By link
How do I execute multiple SQL statements at one time with Oracle?
Added by Roberto Rabe, last edited by Roberto Rabe on May 25, 2005  (view change)
Labels: 
(None)


You could consider using a stored procedure! Or if the statements are meant to execute as one transaction, manage the transaction in your application's service layer.

With that in mind, if you need to execute multiple SQL statements in one DataMapper <statement> with Oracle using MS OracleClient or ODP.NET 10g, try wrapping those statements in a BEGIN...END; PL/SQL block.

<statement id="DeleteAccount" parameterClass="Account">
    BEGIN DELETE FROM ORDERS WHERE ACCOUNT_ID = #Id#;
    DELETE FROM ACCOUNTS WHERE ACCOUNT_ID = #Id#; END;
    </statement>

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators