Solved

How do I write a CASE statement in BDE Local SQL

Posted on 2008-06-11
6
1,359 Views
Last Modified: 2013-11-23
Hi Team,

I'm trying to get Database Tour to run a CASE statement like

Case GROUPCODE
WHEN sum(invdtl.linetot) = 0 then '"G0"
WHEN sum(invdtl.linetot) between 1 and 1000 then '"G999"
WHEN sum(invdtl.linetot) between 1000 and 2000 then '"G1999"

End Case as 'GROUPCODE'

I get an error saying

"Invalid use of Keyword
Token: CASE"

I gather "CASE" is not supported in the BDE implementation of local SQL

How should I write this now?

 Cheers
bernard

 
0
Comment
Question by:BernardGBailey
  • 3
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
rfwoolf earned 500 total points
ID: 21765054
You are correct - CASE is not supported by BDE Local SQL.
If you go into your BDE directory (usually at C:\Program Files\Common Files\Borland Shared\BDE you will see a file called LOCALSQL.HLP. If you open it and go to Index -> Unsupported Language it lists "CASE" as unsupported
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21765063
My advice is to just execute multiple queries according to what you're trying to do.
So do one query, get the result, then in delphi say
if between 0 and 1000 then G999. etc
then build another query using a parameter, and insert G999 into the parameter
0
 

Author Comment

by:BernardGBailey
ID: 21765088
Would a subselect work just as well or is that not supported either?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 13

Expert Comment

by:rfwoolf
ID: 21765133
Hmmm. . i think it is supported in some ways...
Using the help file I told you about, looking up "SubQueries" you can use
the IN predicate
the EXISTS predicate
and it also mentions the SOME/ANY/ALL predicates
0
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 21766186
There is still the possibilty of installing a database on your local computer.
Like the MSSQL Desktop Engine, Oracle10G, Interbase, ...

Most of the databases can be run locally, you would then have the full power of a rdbms system at your disposal.

if it's an older computer the 2000 MSDE for example
http://www.microsoft.com/downloads/details.aspx?familyid=413744D1-A0BC-479F-BAFA-E4B278EB9147&displaylang=en
0
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 21863338
anyway you have an incorrect syntax in your case too ...

Case
  WHEN sum(invdtl.linetot) = 0 then '"G0"
  WHEN sum(invdtl.linetot) between 1 and 1000 then '"G999"
  WHEN sum(invdtl.linetot) between 1000 and 2000 then '"G1999"
ELSE
  NULL
End Case as 'GROUPCODE'

Removed GROUPCODE from the top
you don't have an ELSE section (not necessary but then this is what you get)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now