Progress OpenEdge allows you quickly building database-driven applications, but the Progress ABL (4GL) language uses own approach to query and modify the data.
Assume we have a table defined using the following SQL CREATE TABLE statement:
CREATE TABLE cities ( city VARCHAR(50), country VARCHAR(50), continent VARCHAR(50) );
To insert a row into this table, we can use SQL INSERT statement:
INSERT INTO cities VALUES ('Boston', 'United States', 'North America');
In Progress ABL, we firstly need to use the CREATE statement that inserts a new row with default values into a table, and then use ASSIGN statement or = operator to set the column values:
/* Inserts a new row with default values set */ CREATE cities. city = "Boston". country = "United States". continent = "North America".
Inserting multiple rows using SQL:
INSERT INTO cities VALUES ('London', 'United Kingdom', 'Europe'); INSERT INTO cities VALUES ('Paris', 'France', 'Europe');
Inserting multiple rows using Progress ABL:
CREATE cities. city = "London". country = "United Kingdom". continent = "Europe". CREATE cities. /* ASSIGN is similar to = operator and it allows specifying multiple values */ ASSIGN city = "Paris" country = "France" continent = "Europe".
Note the following about Progress ABL:
To delete all rows from a table you can use SQL DELETE or TRUNCATE statements:
-- DELETE allows specifying WHERE conditions and it is logged DELETE FROM cities; -- TRUNCATE deletes all rows and cannot be rolled back TRUNCATE TABLE cities;
In Progress ABL, you can use FOR EACH loop and DELETE statement to delete rows:
/* Delete all rows in cities table */ FOR EACH cities: DELETE cities. END.
To update rows in a table you can use SQL UPDATE statement:
UPDATE cities SET city = 'Nice' WHERE country = 'France';
In Progress ABL, you can use FOR EACH to iterate over rows and perform the update, or FIND FIRST to update a single row based on a search condition:
FOR EACH cities WHERE country = "France": city = "Nice". END. FIND FIRST cities WHERE country = "France". city = "Nice".
To retrieve rows from a table you can use SQL SELECT statement:
SELECT * FROM cities;
In Progress ABL, you can use FOR EACH to retrieve rows, or FIND FIRST to select a single row based on a search condition:
FOR EACH cities: DISPLAY cities. END. FIND FIRST cities WHERE country = "France". DISPLAY cities.