You can use SQL in many different environments. Some of them are
discussed here.
Use a cursor
When SQL runs a select statement, the resulting rows comprise the result table. A cursor provides a way to access a result table.
Dynamic SQL applications
Dynamic SQL allows an application to define and run SQL statements at program run time. An application that provides for dynamic SQL accepts as input (or builds) an SQL statement in the form of a character string. The application does not need to know what type of SQL statement it will run.
Use interactive SQL
Interactive SQL allows the programmer or database administrator to quickly and easily define, update, delete, or look at data for testing, problem analysis, and database maintenance.
Use the SQL statement processor
The SQL statement processor allows SQL statements to be run from a source member. The statements in the source member can be run repeatedly, or changed, without compiling the source. This makes the setup of a database environment easier.