|
Hi Andy, here are some advantages of using embedded SQL: 1. Programmers with SQL knowledge can understand RPG programs without learning native file operations. 2. The same or a similar SQL code can be embedded in different programming languages and can be maintained with minor efforts. Besides SQL is Standard, the same SQL code or sightly modified SQL code can be used to get access to other databases. 3. With native I/O the file description is stored into the program object. If a file must be modified, all programs and modules that use this file must be recreated to embed the new file description. With embedded SQL the file description is not stored into the program object. If you select single fields instead of the whole record, you do not have to recompile your programs or modules, when the underlying file is modified. It is even possible to create a program or module containing SQL that uses a file that does not exist at compile time. 4. SQL provides a variety of scalar functions that does not exist in RPG but easily can be exploited, such as determine the Day of Week. 5. Take advantage of SQL scalar functions, user defined functions (UDF), and user defined table functions (UDTF), which can be used in SQL statements. 6. Stored procedures can be called by using an SQL CALL statement. 7. SQL can simplify the program logic when multiple rows are included in an operation, such as UPDATE or DELETE, or multiple joins are included in a single SQL statement. 8. SQL provides much more powerful possibilities to join tables, like LEFT OUTER JOIN or EXCEPTION JOIN. 9. A couple of column functions allows you to easily calculate totals, averages, minimums, and maximums. 10. SQL allows you to merge data from several tables by using the UNION statement. 11. SQL provides additional isolation levels and the SAVEPOINT statement that allows a partial ROLLBACK. 12. Using embedded SQL will you allow to take advantage of the enhancements of the new SQL Query Engine (SQE). Birgitta -----Ursprüngliche Nachricht----- Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Andy Hautamaki Gesendet: Freitag, 22. April 2005 18:38 An: RPG400-L@xxxxxxxxxxxx Betreff: Embeded SQL in RPG what are some good scenarios where it would beuseful? This is an innocent question and I hope this doesn't lead to an all out war on the virtues of using SQL........... :} I'm curious on what are some situations when it would be a good idea to use embedded SQL in RPG? Sorry for the very broad question, but I'm not very familiar with using it in RPG and wanted to know if its something I should learn more about. Andy -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.