Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 10 of 10 total |
Result of a query in my program is not the same with ElevateDB Manager |
Wed, Jan 25 2012 9:10 AM | Permanent Link |
Josselin | Hi,
This is the script I use : SCRIPT BEGIN DECLARE Cursor1 CURSOR WITHOUT RETURN FOR Stmt1; DECLARE Cursor2 CURSOR WITHOUT RETURN FOR Stmt2; DECLARE Montant1 FLOAT; DECLARE Ident1 VARCHAR(4); PREPARE Stmt1 FROM 'SELECT SUBSTRING(MetreA FROM 1 FOR 4) AS Code, (SUM(IF(Poser = 0 THEN Q*Pose ELSE 0))+SUM(IF(Fournis = 0 then Q*Fourniture ELSE 0)))AS Montant FROM Travail WHERE (Unite IS NOT NULL) GROUP BY Code'; PREPARE Stmt2 FROM 'SELECT Code,Montant FROM VueQ3'; OPEN Cursor1; OPEN Cursor2; START TRANSACTION ON TABLES 'VueQ3'; BEGIN FETCH FIRST FROM Cursor1 ('Code','Montant') INTO Ident1, Montant1; WHILE NOT EOF(Cursor1) DO INSERT INTO Cursor2('Code','Montant') VALUES (Ident1,Montant1); FETCH NEXT FROM Cursor1 ('Code','Montant') INTO Ident1, Montant1; END WHILE; COMMIT; END; CLOSE Cursor1; CLOSE Cursor2; END In my program, this is the result I obtain : 01VR | 5702.17 05CB | NULL 10SA | NULL I use the same script in ElevateDB Manager with the same data and this is the result I obtain : 01VR | 5702.17 05CB | 10348.00 10SA | 872.00 The result in ElevateDB Manager is good. Why it's not the same result in my program ? Thanks for your help Greetings, Bruno |
Wed, Jan 25 2012 9:34 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Josselin
With something such as this the only possible answer is that the data is different. Roy Lambert [Team Elevate] |
Mon, Jan 30 2012 8:57 AM | Permanent Link |
Josselin | No, I have only one Database
|
Mon, Jan 30 2012 9:23 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Josselin
EDBManager is simply a program written in Delphi using ElevateDB. If you get different answers to a query in your program and EDBManager either the database is different or you are not running the same script or you are doing something else to change things. If you only have one database, and are running the same script, then there has to be something in your code which is causing the difference. Roy Lambert [Team Elevate] |
Mon, Jan 30 2012 9:44 AM | Permanent Link |
Josselin | I Think there is a real problem
I have simplify my Script to a simple query : SELECT SUBSTRING(MetreA FROM 1 FOR 4) AS Code, (SUM(IF(Poser = 0 THEN Q*Pose ELSE 0))+SUM(IF(Fournis = 0 then Q*Fourniture ELSE 0))) AS Montant FROM Travail WHERE (LENGTH(Unite)>0) GROUP BY Code this is the result in the program : 01VR | 5702.17 05CB | NULL 10SA | NULL And this is the result of the same query using ElevateDB Manager with the same database : 01VR | 5702.17 05CB | 10348.00 10SA | 872.00 If I smplify the SELECT clause of my query (just to try) like this SELECT SUBSTRING(MetreA FROM 1 FOR 4) AS Code, SUM(Q*Pose) AS Montant FROM Travail WHERE (LENGTH(Unite)>0) GROUP BY Code This is the result in my program : 01VR | 4111.441 05CB | 2788 10SA | 762 And this is the result of the same query using ElevateDB Manager with the same database : 01VR | 4111.441 05CB | 2788 10SA | 762 I think there is in the first query, in the SELECT clause, something that does not work well but I do not know what... |
Mon, Jan 30 2012 9:57 AM | Permanent Link |
Josselin | I have try another thing with the query :
SELECT SUBSTRING(MetreA FROM 1 FOR 4) AS Code, SUM(Pose)+SUM(Fourniture) AS Montant FROM Travail WHERE (LENGTH(Unite)>0) GROUP BY Code In the program the result is : 01VR | 87.95 05CB | NULL 10SA | NULL In ElevateDB Manager with the same data the result is : 01VR | 87.95 05CB | 247.40 10SA | 3654.10 I think it's in "SUM(Pose)+SUM(Fourniture) AS Montant" there is a problem in the program but I don't know why... |
Mon, Jan 30 2012 10:09 AM | Permanent Link |
Uli Becker | Josselin,
as Roy already indicated: EDBManager is a Delphi written application which uses the same components as your application; thus the result must be the same if you use the same data. Please check: 1. Are there any event-handlers in the query component you use? 2. Please check if you have the same version in EDBManager and your components. Uli |
Mon, Jan 30 2012 10:14 AM | Permanent Link |
Josselin | Hi Uli,
I check it, version is the same and I have no event in the component Uli Becker wrote: Josselin, as Roy already indicated: EDBManager is a Delphi written application which uses the same components as your application; thus the result must be the same if you use the same data. Please check: 1. Are there any event-handlers in the query component you use? 2. Please check if you have the same version in EDBManager and your components. Uli |
Mon, Jan 30 2012 11:10 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Josselin
Can you post the database (catalog and table files) to the binaries? If so I'll try your script out here. Also what version of ElevateDB are you running? What programming environment are you using? Which version of Windows? Roy Lambert [Team Elevate] |
Mon, Jan 30 2012 1:46 PM | Permanent Link |
Fernando Dias Team Elevate | There is a detail that had sometimes fooled me, its when some issue is visible when using local access but not with remote sessions, or the other way round... Just a thought ... -- Fernando Dias [Team Elevate] |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |