I've found that it often helps with an execute block when updates with 
complex join-like filter conditions apply.

Something like this (untested):

set term #;
execute block as
declare PK yourprimarykeycolumntype;
begin
   for
     select MB.PRIMARYKEYCOLUMN
     from MY_BOOK MB
     inner join MY_BOOK_HEADER MBH
       on MBH.PK_BOOK_HEADER = MB.SK_BOOK_HEADER
     where Upper(Trim(MBH.HEADER_BOOK_CODE)) = 
Upper(Trim('127518010109038'))
       And MBH.FK_BOOK_GROUP =  '{79B79C33-CE56-4084-912B-6DD9F70B3DC4}'
     into :PK
   do
     update MY_BOOK MB
     set BOOK_NAME = 'Book Name1' ,
       BOOK_DESCRIPTION = 'Book Desfcription1'
     where MB.PRIMARYKEYCOLUMN = :PK
end#
set term ;#

Kjell Rilbe
Telefon: 08-761 06 55
Mobil: 0733-44 24 64

Marknadsinformation i Sverige AB
Ulvsundavägen 106C
168 67 Bromma
www.marknadsinformation.se <http://www.marknadsinformation.se>
08-514 905 90

den 2015-10-14 11:21, skrev Vishal Tiwari vishuals...@yahoo.co.in 
[firebird-support]:
> Hi All,
>
> I have 480 Update SQL statements which I am executing using ADScript 
> component in Delphi 2010.
>
> Update SQL updates data in only one table called MY_BOOK, but there is 
> a join with MY_BOOK_HEADER table. Below is the Update SQL, which is 
> taking 81 seconds to execute all 480 Update SQL statements. Any idea 
> how could I improve the speed of these 480 Update SQL statements ?
>
> Update SQL:
>
> Update MY_BOOK MB SET BOOK_NAME = 'Book Name1' , BOOK_DESCRIPTION = 
> 'Book Desfcription1'
> Where MB.BOOK_TYPE = 4 And
> Exists (Select 1 from MY_BOOK_HEADER MBH
>     Where
>         Upper(Trim(MBH.HEADER_BOOK_CODE)) = Upper(Trim('127518010109038'))
>         And MBH.FK_BOOK_GROUP =  '{79B79C33-CE56-4084-912B-6DD9F70B3DC4}'
>         And MBH.PK_BOOK_HEADER = MB.SK_BOOK_HEADER
>         );
>
>
> Thanks In Advance.
>
> With Best Regards.
>
> Vishal
> 


Reply via email to