| View previous topic :: View next topic |
| Author |
Message |
Vlad Gonchar Guest
|
Posted: Wed Feb 18, 2004 6:59 pm Post subject: it's awful... |
|
|
The following code
aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50'));
aQuery.Sql.Add('and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;
fails at Oracle 8i with message like "There is not right parentheses" at
NT4, but works at WinXP, W2K...
Merge lines 3 and 4:
aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50 and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;
It works?! Is anybody aware about this ? What's the reason ?
|
|
| Back to top |
|
 |
Kevin Frevert Guest
|
Posted: Wed Feb 18, 2004 7:06 pm Post subject: Re: it's awful... |
|
|
"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> wrote
| Quote: |
It works?! Is anybody aware about this ? What's the reason ?
aQuery.Sql.Add('and not (ObjId>=-50'));
|
Try... aQuery.Sql.Add('and not (ObjId >= 50)');
krf
|
|
| Back to top |
|
 |
Vlad Gonchar Guest
|
Posted: Wed Feb 18, 2004 8:12 pm Post subject: Re: it's awful... |
|
|
It is slip of fingers. Correct line is
aQuery.Sql.Add('and not (ObjId>=-50');
|
|
| Back to top |
|
 |
Kevin Frevert Guest
|
Posted: Wed Feb 18, 2004 8:21 pm Post subject: Re: it's awful... |
|
|
Did that take care of it or are you still getting an error?
krf
"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> wrote
| Quote: | It is slip of fingers. Correct line is
aQuery.Sql.Add('and not (ObjId>=-50');
|
|
|
| Back to top |
|
 |
Vitali Kalinin Guest
|
Posted: Thu Feb 19, 2004 10:36 am Post subject: Re: it's awful... |
|
|
Always enclose such code with Sql.BeginUpdate Sql.EndUpdate pair
"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> сообщил/сообщила в новостях следующее:
news:4033b609$1 (AT) newsgroups (DOT) borland.com...
| Quote: | The following code
aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50'));
aQuery.Sql.Add('and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;
fails at Oracle 8i with message like "There is not right parentheses" at
NT4, but works at WinXP, W2K...
Merge lines 3 and 4:
aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50 and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;
It works?! Is anybody aware about this ? What's the reason ?
|
|
|
| Back to top |
|
 |
Vlad Gonchar Guest
|
Posted: Thu Feb 19, 2004 1:58 pm Post subject: Re: it's awful... |
|
|
| Quote: | Did that take care of it or are you still getting an error?
|
No, it doesn not work. I did the mistake when typing the question.
But the metter is still there.
|
|
| Back to top |
|
 |
Vlad Gonchar Guest
|
Posted: Thu Feb 19, 2004 3:16 pm Post subject: Re: it's awful... |
|
|
| Quote: | Always enclose such code with Sql.BeginUpdate Sql.EndUpdate pair
|
Thank you, Vitalik
|
|
| Back to top |
|
 |
Kevin Frevert Guest
|
Posted: Thu Feb 19, 2004 3:25 pm Post subject: Re: it's awful... |
|
|
OK, just wanted to make sure. Have you tried saving the SQL to a file and
running it in an Oracle query tool (just to be 100% sure all the parenthesis
match)?
You could simply set up the query at design time (write/test the code in
your favorite query tool, copy into the component) and open at runtime.
IMO, it saves a whole lot of time 6 months from now when (not if) users want
something changed.
Good luck,
krf
"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> wrote
| Quote: | Did that take care of it or are you still getting an error?
No, it doesn not work. I did the mistake when typing the question.
But the metter is still there.
|
|
|
| Back to top |
|
 |
|