Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 24 total
Thread DELETE WHERE IN SELECT gives EConvert error
Tue, Jun 27 2006 5:11 AMPermanent Link

Chris Erdal
I'm setting up a script to do maintenance on a history-type file of
payments due.

The first statement removes any payments (loyerDu) no longer due because
a user has altered the start or end date of a contract (Location).

It works fine in DBSYS, but gives an error in a DBISAMQuery.ExecSQL.

Here's the code:

DELETE FROM LoyersDus
WHERE loyNum IN
( SELECT loyNum
 FROM LoyersDus, Locations
 WHERE (loyLocation = locNum)
 AND (
       ((locDateFin <> NULL) AND (loyDate > CAST(CAST(EXTRACT
(YEAR,locDateFin) AS CHAR(4))+'-'+CAST(EXTRACT(MONTH,locDateFin) AS CHAR
(2))+'-01' AS DATE)))
       OR (loyDate < CAST(CAST(EXTRACT(YEAR,locDateDebut) AS CHAR(4))
+'-'+CAST(EXTRACT(MONTH,locDateDebut) AS CHAR(2))+'-01' AS DATE))
     )
)
;

And the error is:

Project project1.exe raised an exception class EConvertError with message
''' is not a valid integer value. Process stopped...

Pressing OK and F7 gives a new error box saying:

Project project1.exe raised an exception class EConvertError with message
''--01

These two messages are repeated apparently ad infinitum until I  hit
Ctrl-F2.

I don't understand where the error is coming from, particularly as DBSYS
executes it just fine. I wondered if an empty set for the IN clause might
be the problem, but that seems unlikely...

Here are the table definitions:

/* SQL-92 Table Creation Script with DBISAM Extensions */

CREATE TABLE IF NOT EXISTS "Locations"
(
  "locNum" AUTOINC NOT NULL,
  "locClient" INTEGER NOT NULL,
  "locInstrument" INTEGER NOT NULL,
  "locArchet" BOOLEAN DESCRIPTION 'Archet fourni avec l''instrument'
DEFAULT TRUE,
  "locEtui" BOOLEAN DESCRIPTION 'Etui fourni avec l''instrument' DEFAULT
TRUE,
  "locHousse" BOOLEAN DESCRIPTION 'Housse fournie avec l''instrument'
DEFAULT FALSE,
  "locTarifMensuel" DECIMAL(0,4) DESCRIPTION 'Montant en euros du loyer
mensuel',
  "locCaution" DECIMAL(0,4) DESCRIPTION 'Montant en euros de la
caution',
  "locDateDebut" DATE DESCRIPTION 'Date dbut de ce contrt pour ce
client' NOT NULL DEFAULT CURRENT_DATE,
  "locDateRenouvellement" DATE DESCRIPTION 'Date du dernier
renouvellement du contrt' DEFAULT CURRENT_DATE,
  "locDureMois" INTEGER DESCRIPTION 'Nombre mois entre renouvellements
(0=indfini)' DEFAULT 12,
  "locDateFin" DATE,
  "locAchat" BOOLEAN DESCRIPTION 'Instrument achet par client aprs
location',
  "locNotes" MEMO,
  "locRemisePremierMois" DECIMAL(0,0) NOT NULL DEFAULT 0,
  "locRemiseDernierMois" DECIMAL(0,0) NOT NULL DEFAULT 0,
PRIMARY KEY ("locNum") COMPRESS NONE
DESCRIPTION 'Contrat de location'
LOCALE CODE 1036
USER MAJOR VERSION 1
USER MINOR VERSION 2
);

CREATE INDEX IF NOT EXISTS "ixLocClient" ON "Locations" ("locClient")
COMPRESS DUPBYTE;
CREATE INDEX IF NOT EXISTS "ixLocInstrument" ON "Locations"
("locInstrument") COMPRESS DUPBYTE;
CREATE INDEX IF NOT EXISTS "ixLocDateDebut" ON "Locations"
("locDateRenouvellement") COMPRESS DUPBYTE;

CREATE TABLE IF NOT EXISTS "LoyersDus"
(
  "loyNum" AUTOINC NOT NULL,
  "loyLocation" INTEGER NOT NULL,
  "loyDate" DATE NOT NULL,
  "loyMontantTTC" DECIMAL(0,0) NOT NULL,
  "loyTVA" INTEGER NOT NULL,
  "loyAnneeMois" INTEGER,
PRIMARY KEY ("loyNum") COMPRESS NONE
DESCRIPTION 'Montants dus pour chaque contrat de location'
LOCALE CODE 0
USER MAJOR VERSION 1
);

CREATE INDEX IF NOT EXISTS "ByloyLocation" ON "LoyersDus" ("loyLocation")
COMPRESS FULL;
CREATE INDEX IF NOT EXISTS "ByloyAnneeMois" ON "LoyersDus"
("loyAnneeMois") COMPRESS FULL;

Thanks for any comments Frown

--
Chris
Tue, Jun 27 2006 6:50 AMPermanent Link

Chris Erdal
Chris Erdal <chris@No-Spam-erdal.net> wrote in
news:Xns97EF7165FE9F714torcatis@64.65.248.118:

Forgot to mention:
XP Pro SP2 + D7 Architect + DBISAM 4.24 build 1

a few more points:

1/ The problem disappears when executing the program (and hence the script)
outside the IDE

2/ inside the IDE, replacing the DELETE FROM with a SELECT * I can open the
Query with no errors and see the empty result set in a DBGrid, but
compiling and running it I get the same error messages.

perhaps I need to re-install Delphi?

--
Chris
Tue, Jun 27 2006 7:02 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Chris


Since DBSys is simply another app using DBISAM either the DBISAM version differs between DBSys and your app or its a data problem.

I'd check your data. Try running each of the bits in your WHERE clause to try an pin it down.

Roy Lambert
Tue, Jun 27 2006 7:32 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Chris



What happens with


DELETE FROM LoyersDus
WHERE loyNum IN
( SELECT loyNum
 FROM LoyersDus, Locations
 WHERE (loyLocation = locNum)
 AND (
       ((locDateFin <> NULL) AND (loyDate > CAST(CAST(EXTRACT
(YEAR,locDateFin) AS CHAR(4))+'-'+CAST(EXTRACT(MONTH,locDateFin) AS CHAR
(2))+'-01' AS DATE)))
       OR
((locDateDebut <> NULL) AND    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
(loyDate < CAST(CAST(EXTRACT(YEAR,locDateDebut) AS CHAR(4))
+'-'+CAST(EXTRACT(MONTH,locDateDebut) AS CHAR(2))+'-01' AS DATE))
     )
)
)
;


Roy Lambert
Tue, Jun 27 2006 7:56 AMPermanent Link

Chris Erdal
Roy Lambert <roy.lambert@skynet.co.uk> wrote in
news:964FD841-26CD-4AB5-B2D2-5D6B751563F6@news.elevatesoft.com:

> Since DBSys is simply another app using DBISAM either the DBISAM
> version differs between DBSys and your app or its a data problem.

Thanks for replying so fast, Roy.

As you see from my followup, my app works fine, just like DBSYS, when
run outside the IDE.

> I'd check your data.

I'm using the same data for each test.

I verified the 2 tables involved, and got no errors.

> Try running each of the bits in your WHERE clause
> to try an pin it down.

I tried that in DBSYS, and all the bits worked.

:-/
--
Chris
Tue, Jun 27 2006 8:04 AMPermanent Link

Chris Erdal
Roy Lambert <roy.lambert@skynet.co.uk> wrote in news:63B7F994-C95C-4397-
8C21-977E6935CF6B@news.elevatesoft.com:

> What happens with
>
>
> DELETE FROM LoyersDus
> ...
> ((locDateDebut <> NULL) AND    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I was about to reply "but I know locDateDebut isn't NULL"
when I thought "never count on user data conforming to your
expectations" Wink

But, unfortunately, your SQL gives the same errors (running from inside the
IDE).

Could you possibly install my 2 tables and run the SQL from a default
project with Button opening a DBISAMQuery just to see if it's my IDE setup?
I've eliminated everything I can think of from the packages list, but you
never can tell.

--
Chris
Tue, Jun 27 2006 8:11 AMPermanent Link

Chris Erdal
Chris Erdal <chris@No-Spam-erdal.net> wrote in
news:Xns97EF8D40AD48014torcatis@64.65.248.118:

> I tried that in DBSYS, and all the bits worked.
>

Hang on a minute - rereading that I realised I hadn't tried that in the
IDE.

If I remove the WHERE IN part I still get the error (but still just in
the IDE):

SELECT loyNum
 FROM LoyersDus, Locations
 WHERE (loyLocation = locNum)
 AND (
       ((locDateFin <> NULL) AND (loyDate > CAST(CAST(EXTRACT
(YEAR,locDateFin) AS CHAR(4))+'-'+CAST(EXTRACT(MONTH,locDateFin) AS CHAR
(2))+'-01' AS DATE)))
       OR
((locDateDebut <> NULL) AND   
(loyDate < CAST(CAST(EXTRACT(YEAR,locDateDebut) AS CHAR(4))
+'-'+CAST(EXTRACT(MONTH,locDateDebut) AS CHAR(2))+'-01' AS DATE))
     )
)
;


--
Chris
Tue, Jun 27 2006 8:26 AMPermanent Link

Chris Erdal
Chris Erdal <chris@No-Spam-erdal.net> wrote in
news:Xns97EF8EA2CC58214torcatis@64.65.248.118:

> Could you possibly install my 2 tables and run the SQL from a default
> project with Button opening a DBISAMQuery just to see if it's my IDE
> setup? I've eliminated everything I can think of from the packages
> list, but you never can tell.
>

I've attached a test project. Just unzip it into a temp folder and open it
in Delphi. It should run OK.

--
Chris
Tue, Jun 27 2006 8:26 AMPermanent Link

Chris Erdal

=ybegin line=128 size=4051 name=TestScript.zip
zu-=n>*,***^************=n***Yzu-=n>*,***^************3***YnYzu-=n>*,*2*W^I****,**@***YnYvX
*اSG5Yg;N2͊,*zu-=n>*,*2*W^+K-,***\**@***YnYvXy=}k>QPw5(+=@u5No=nvQ
Q~=nYfR ;;fz9J[]働ԎXPfa-+#AyH! H$(${J뼤Y=nI&V~Xm5mIJ=} }^~)V\JYiٰ
XYox3q@s)U`Xyյo%ٳCJ'=M3QϕJ' )H R=I2L4<3<\o Eێu5pգzu)F¿(J%?}
'y-)w 2 Z*fO:$GqY=IAjo5[؍=}HSx85ۊ`CLExk(BKpQ/Zirnł ImEk] _0( s&8>)
?I?368G)&ԩM}_)S8ڄ`RS)w|E0(5S )C-5Dm)ɸM)ꯊ)AֵͰaҝZ&/
wC()Vtv=n7R$'!c<)ȞKӍ+>#LR'sA :_':9&%#C^ 'zqI,N =n)w:9=I3
R=I-Pĩ_*w&Qݽ/D9=I)Zs))#/zu-=n>*,*2*W^0û+*****@***YnYvXwtj>ۨGFssJN=nlRo
l/=J=}AM땲LwZ&Z\ٽZv_T!y9' =MliA* ޡ`Qoa*}#Y*$$9P !e$i
HA(=n^(aY*******************************Ȇy^i&*xw%+d&FCbrQ~Q1'JI\Any~hՈ=M é7V
ýP~T0g9h2mV=MpX !׿X*****"h+zu-=n>*,*2*W^,+***>**@***YnYvnX*اSG5
Yg;N4LBj>=}U#U9 "N>Uξ@U>@SNN@TN-O<u>||?=}u\B3b4r,6c#-:fw@rZZrp R\=J0ЩIv~-=J
lA(p)R\1Щ 3**$I/~0V69簮b9ޥ+8:[(q++U'I<b8-Ii46B=I[YY_aiݢǭ?je>6e**zu-=n>*,
*2*W^5:n+*****@***YnYvnXtZB=@}9QgdW֯H0L=J{=J=}Y=Jo/mwdnl')J=IullB=M
icg㨥ݖ׏XE )ߙ*$F6V=@=I0  aG%#=M(!********************************~b&ګ7
0=@Pީ{ɰWi31l6FCZ_Yz[|[[F XG V~  gf8[Mv[ ըQ#V9=MfɃ=Iy&ػ]-****=J#,zu
-=n>*,*2*}^ X=@g******:***Yz[X4Z:!j ltJQ;=naS+gs3\  '=Ik&R"a8n+ V:m3X=@
/8xpZgNc0Nh(AkZG$\=I "WYAzu-=n>*,*2*˚^a71-**1**7***Y[X~j:)|I*Kp=M~
h<Jwd=@W8O85Ef=IX'L$fRT=IK^Ni3 xj"R!,qdle`-lAuyucvB<wUf ZsYF=}Z cOx],#=IH
9=J=nIMq&OL٣=MIÐF=M?$:RNS'_Z=IN=J)(=ns\}\s=n 'N5@=I:֭/˽>`jNro$_uХoȝP=n
YTe|#hi03Z~kw"BӫsF ktPeЗŖ" {bJȐjf0m/6,20oQ Fr"+dfK)Ԁ=JE
Ed%żprU=J:54Z@ʗ9_CeY\eɴVtCx%cJV>\hzp^@h^^MݴC 押F7og_
2i2O]X@q\¶nW8Bv7F"/Z,:cKGq(IBg0#Q0P_Di66@_O#p=Mp7x'?$a=I380,ʧbq
%joq^z^=@J=I d#BgۦPgqoH%V()F1[6B>=M6S >يc؅A =IkX|SU\
<9zu-=n>*,*2*v^A+**,**7***Y[X|Z>A$iZ8ZW[  OwtTL(uԝJi!pm 6J6Z=@*=n0G0
!6E Uu}ZD~N>>pswԞ9|xu6pKø_ ؏8_ʡ[3J/?co+B?DBMϦ }PE*X=JUNX
9U*>=MA=I{0(/d"DMZ-R>o7gWq?lk@)+4XF=@3S(F`%`FfwPҍeՓv
"GD&i|u=}Ʊb6*zu+,>*>*,***^************=n*********Z*******Yzu+,>*>*,***^************3*********Z***
L***YnYzu+,>*>*,*2*W^I****,**@*********J***s***YnYvXzu+,>*>*,*2*W^+K-,***\**@*********J******
YnYvXzu+,>*>*,*2*W^0û+*****@*********J***-**YnYvXzu+,>*>*,*2*W^,+***>**@*********J
***J/**YnYvnXzu+,>*>*,*2*W^5:n+*****@*********J***0**YnYvnXzu+,>*>*,*2*}^ X=@g******:*
********J***1**Yz[Xzu+,>*>*,*2*˚^a71-**1**7*********J***2**Y[Xzu+,>*>*,*2*v^A+**,**7********
*J***5**Y[Xzu/0****4*4*,**v7****
=yend size=4051 crc32=c0bd866f
Tue, Jun 27 2006 9:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Chris


You attach it - I'll try it Smiley

Roy Lambert

Chris Erdal <chris@No-Spam-erdal.net> wrote on Tue, 27 Jun 2006 08:26:38 -0400

>Chris Erdal <chris@No-Spam-erdal.net> wrote in
>news:Xns97EF8EA2CC58214torcatis@64.65.248.118:
>
>> Could you possibly install my 2 tables and run the SQL from a default
>> project with Button opening a DBISAMQuery just to see if it's my IDE
>> setup? I've eliminated everything I can think of from the packages
>> list, but you never can tell.
>>
>
>I've attached a test project. Just unzip it into a temp folder and open it
>in Delphi. It should run OK.
>
>--
>Chris
Page 1 of 3Next Page
Jump to Page:  1 2 3
Image