Difference between revisions of "SQLRPGLE"
From MidrangeWiki
(→SQL Directives) |
|||
Line 5: | Line 5: | ||
= RPG IV with Embedded SQL = | = RPG IV with Embedded SQL = | ||
== Introduction to RPG IV with Embedded SQL== | == Introduction to RPG IV with Embedded SQL== | ||
− | SQL is a powerful tool in any programmer's skill set. It is possible to leverage this tool from within RPG (& other languages). The source member type for these programs is SQLRPGLE. | + | SQL is a powerful tool in any programmer's skill set. It is possible to leverage this tool from within [[:Category:RPG|RPG]] (& other languages). The source member type for these programs is SQLRPGLE. |
Here is an example of an embedded SQL statement: | Here is an example of an embedded SQL statement: | ||
<pre> | <pre> |
Revision as of 02:21, 17 July 2005
RPG IV with Embedded SQL
Introduction to RPG IV with Embedded SQL
SQL is a powerful tool in any programmer's skill set. It is possible to leverage this tool from within RPG (& other languages). The source member type for these programs is SQLRPGLE. Here is an example of an embedded SQL statement:
C/EXEC SQL C+ SELECT * FROM mylib/myfile C/END-EXEC
SQL Directives
SQL Directives | ||
---|---|---|
Directive | Function performed | |
SELECT | The Select directive is used to extract data from a Physical file or Table | |
DECLARE | The Declare Cursor directive is used to define a data path in your program | |
OPEN | The Open Cursor directive is used to open a data path defined by a Declare Cursor directive. | |
CLOSE | The Close Cursor directive is used to close a data path opened by a Open cursor directive | |
FETCH | The Fetch directive is used to extract records from a data path opened via the Open Cursor directive | |
PREPARE | The Prepare directive is used to prepare an dynamic SQL statement for execution | |
EXECUTE | The Execute directive is used to execute an dynamic SQL statement prepared via the Prepare directive | |
EXECUTE IMMEDIATE | The Execute Immediate directive is used to execute an SQL statement directly & does not require a Prepare directive | |
DELETE | The Delete directive is used to delete data from a Physical file or Table | |
DROP TABLE | The Drop Table directive is used to delete a Physical file or Table | |
CREATE TABLE | The Create Table directive is used to create a Physical file or Table | |
ALTER TABLE | The Alter Table directive is used to change file & field attributes in a Physical file or Table | |
UPDATE | The Update directive is used to update data from a Physical file or Table |