Cannot locate record in delphi ADO query

Posted by Danatela on Stack Overflow See other posts from Stack Overflow or by Danatela
Published on 2014-05-29T03:12:36Z Indexed on 2014/05/29 3:26 UTC
Read the original article Hit count: 133

Filed under:
|
|

I can't locate any record in TADOQuery using PK. First, I was trying to use standard Locate method:

PPUQuery.Locate('ID', SpPlansQuery['PPONREC'], []);

It always returns False, but manual search (passing the whole query matching ID with given PPONREC which is really slow) finds the desired row. I tried using loPartialKey and switched CursorLocation of query to clUseServer, but it didn't help.

Next, I tried to filter my PPUQuery:

PPUQuery.Filter := 'ID = ' + VarToStr(SpPlansQuery['PPONREC']);
PPUQuery.Filtered := True;
PPUQuery.First;

But after that the PPUQuery.Eof is True and PPUQuery.RecordCount equals 0.

Underlying database is Oracle 9 and the ID is of type INTEGER and is PK of table TPORDER_CMK. PPUQuery.SQL is:

SELECT tp.*, la.*, lm.*, ld.*, ld1.*, to_cmk.*
  FROM ppu_plan.tporder_cmk tp
       JOIN PPU_PLAN.LARTICLES la
          ON TP.ARTICLE = LA.ID
       JOIN PPU_PLAN.LMATERIAL lm
          ON TP.MATERIAL = lm.id
       JOIN PPU_PLAN.LCADEP ld
          ON TP.CADEP = LD.ID
       JOIN PPU_PLAN.LCADEP ld1
          ON TP.PRODUCER = LD1.ID
       JOIN PPU_PLAN.TORDER_CMK to_cmk
          ON TP.order_id=TO_cmk.ID
WHERE TP.PLAN_ID = :pplan_id

What should I try next and how to solve this problem?

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle