[fixed in 9.7.24] TOraQuery does not generate update code

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

[fixed in 9.7.24] TOraQuery does not generate update code

Post by pcz » Fri 08 Apr 2016 12:08

Hello

I got a little problem with TOraQuery object and internal generation of update code

My SQL:

Code: Select all

with ww_min as
(
  select min(wiek) w_min
  from inw_wsp_wiek ww_g
)
select ww.id_sezonu, dwp.wartosc_param sezon, ww.wiek, ww.wspolczynnik,
      decode(ww.wiek, ww_m.w_min, 'T', 'N') czy_kasowac
from inw_wsp_wiek ww
     join
     it_dop_wartosc_param dwp
     on (dwp.id = ww.id_sezonu)
     cross join
     ww_min ww_m
TOraQuery just don't generate any update code by itself...
Both "UpdatingTable" and "KeyFields" properties have proper values

I change field values, call "Post" and nothing...

But when I
- set "SQLUpdate" manual
or
- change main SQL to "select * from inw_wsp_wiek"
everything is ok...

Any clues?...

Regards
P.C.
Last edited by pcz on Tue 28 Jun 2016 08:04, edited 1 time in total.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraQuery does not generate update code - why?

Post by AlexP » Mon 11 Apr 2016 05:11

Helo,

Please specify the versions of ODAC, IDE, and the scripts for creating database objects.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraQuery does not generate update code - why?

Post by pcz » Mon 11 Apr 2016 05:19

Delphi XE7 Pro + ODAC 9.6.2.2 Pro

By "internal generation" I mean the code that is auto-generated and sent to database after for example changing field value & executing "Post" method (what could be previeved by using "Debug")

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraQuery does not generate update code - why?

Post by AlexP » Mon 11 Apr 2016 05:43

Please send table creating scripts (inw_wsp_wiek, it_dop_wartosc_param )

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraQuery does not generate update code - why?

Post by pcz » Mon 11 Apr 2016 07:17

Sample code with same result:

Code: Select all

create table INW_WSP_WIEK_PC
(
  WIEK INTEGER NOT NULL
)
/
 
insert into inw_wsp_wiek_PC(wiek)
values(0)
/
insert into inw_wsp_wiek_PC(wiek)
values(-1)
/
insert into inw_wsp_wiek_PC(wiek)
values(-2)
/
Select:

Code: Select all

with ww_min as
(
  select min(wiek) w_min
  from inw_wsp_wiek_pc ww_g
)
select ww.wiek, ww_m.w_min
from inw_wsp_wiek_pc ww
     cross join
     ww_min ww_m
TOraQuery properties (KeyFields value does not matter)

Code: Select all

object OraQuery1: TOraQuery
  UpdatingTable = 'INW_WSP_WIEK_PC'
  KeyFields = 'WIEK'
  SQL.Strings = (
    'with ww_min as'
    '('
    '  select min(wiek) w_min'
    '  from inw_wsp_wiek_pc ww_g'
    ')'
    'select ww.wiek, ww_m.w_min'
    'from inw_wsp_wiek_pc ww'
    '     cross join'
    '     ww_min ww_m')
end
1) create new TDataModule
2) instert TOraSession + TOraQuery; set Debug = True, UpdatingTable, ...
3) Double-click, paste SQL
4) Data editor button
5) Updating row values generates no code
6) Attepmting to insert record generates

Code: Select all

INSERT INTO INW_WSP_WIEK_PC
  ()
VALUES
  ()
=> and causes ORA-00928

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraQuery does not generate update code - why?

Post by AlexP » Mon 11 Apr 2016 11:30

Thank you for the sample, we have reproduced the described problem and will investigate the reason for such behavior.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraQuery does not generate update code - why?

Post by pcz » Tue 26 Apr 2016 12:12

It looks like problem still happens with ODAC 9.7.23... :(

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraQuery does not generate update code - why?

Post by AlexP » Tue 26 Apr 2016 14:17

The new verson with this fix will be released tomorrow.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraQuery does not generate update code - why?

Post by pcz » Wed 27 Apr 2016 05:06

Oh... Thank You for information :)
I was just testing update ;)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraQuery does not generate update code - why?

Post by AlexP » Thu 28 Apr 2016 11:58

The new version including these fixes is already available on our website.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraQuery does not generate update code - why?

Post by pcz » Thu 28 Apr 2016 12:24

[Updated to 9.7.24]

Update & Insert code generation now works fine!

Thanks for fix :)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraQuery does not generate update code - why?

Post by AlexP » Thu 28 Apr 2016 12:48

Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.

Post Reply