L11 SQL Programming Flashcards
What is Dynamic SQL?
situations in which query statements themselves are assembled by the host language, perhaps using user input?
Usually consists of two steps (SQL statements):
- Preparing a query:
EXEC SQL PREPARE <query-name></query-name>
FROM ;
- Executing a query:
EXEC SQL EXECUTE <query-name>;</query-name>
What are stored procedures?
- allow us to store procedures as database schema elements.
- PSM (Persistent Stored Modules) = a mixture of conventional statements (if, while, etc.) and SQL.
- Lets us do things we cannot do in SQL alone.
- We can CREATE PROCEDUREs, e.g., and then CALL them from within SQL queries.
What is Embedded SQL?
A preprocessor turns SQL statements into procedure calls that fit with the surrounding host-language code.
I All embedded SQL statements begin with EXEC SQL, so the preprocessor can find them easily.
Embedded SQL is a method of combining the computing power of a programming language and the database manipulation capabilities of SQL. Embedded SQL statements are SQL statements written inline with the program source code of the host language. The embedded SQL statements are parsed by an embedded SQL preprocessor and replaced by host-language calls to a code library.