Re: ExecuteSQL and OpenCursors Problem
From: Jim Kennedy <kennedy-down_with_spammers_at_attbi.com>
Date: Fri, 14 Feb 2003 15:48:41 GMT
Message-ID: <td83a.98128$SD6.5330_at_sccrnsc03>
Date: Fri, 14 Feb 2003 15:48:41 GMT
Message-ID: <td83a.98128$SD6.5330_at_sccrnsc03>
- Use bind variables.
- Open the cursor 1 time, bind it , execute then bind execute. See the Oracle Application Developer's guide. I think you are opening a cursor each time and not closing it. You need to open the cursor once (use bind variables, you will get much better performance) and just reexecute the cursor not keep definig ne ones.
I haven't used the mfc stuff but it should be the same as if you do it in C
or Java or VB etc. in principal.
Jim
-- Replace part of the email address: kennedy-down_with_spammers_at_attbi.com with family. Remove the negative part, keep the minus sign. You can figure it out. "Satish Kumar Venkataraman" <satv_at_optonline.net> wrote in message news:1ec4af85.0302140651.5d8a8f81_at_posting.google.com...Received on Fri Feb 14 2003 - 16:48:41 CET
> Hi,
> I would like to know anybody knew a solution for my problem given
> below:
>
> I have an mfc application which accesses an oracle[8.1x] database.
> Now if make a lot of modifications on a huge set of data which is
> represented as structures in mfc, then try to save the modification
> which result in a big loop trying to run like the following:
>
> try{
> for(....)
> {
> strSQL="Update....."; //form the update query for one data in the
> struct
> db.ExecuteSQL();
> }
> } execption_handler()
>
> if(not something wrong)
> db.CommitTrans();
> else
> db.RollbackTrans();
>
> Now in this code, for each update query in a loop, oracle opens a
> cursor and doesn't close until i close the db connection. even if i
> add a piece of code which closes and opens db connection in the loop
> for every 100 updates [ofcourse after commiting], i lose the
> flexibility of rolling back on an error.
>
> Any suggestions?
>
> Thanks in advance
> Sathish