Bill
Bill

Reputation: 1247

Using a straight sql statement in a progress application

What is the syntax to run a straight sql statement in a progress application?

  SELECT count(distinct myField2) FROM myTable WHERE myField = myVariable);

I've figured out how to do this with a for each but I would still like to run this command. Using a for each:

def var iTmpCount as int no-undo.
for each myTable no-lock where myField = myVariable break by myField2:
  if first-of (myTable.myField2) then 
    iTmpCount = iTmpCount + 1.
end. 

Upvotes: 0

Views: 1065

Answers (1)

Tom Bascom
Tom Bascom

Reputation: 14020

The 4GL has an ancient and deprecated implementation of SQL-89.

You can do some simple things successfully. It is sometimes helpful for an ad-hoc query.

The documentation is limited and, since it is a deprecated feature, it will never be improved or enhanced.

The 4GL is not a SQL tool and the embedded SQL support should not be used. Don't try to apply SQL thinking to 4GL, you will only regret it.

SQL-92 is supported via the ODBC & JDBC drivers. But that is outside the 4GL.

Upvotes: 2

Related Questions