![HP NonStop SQL/MP Programming Manual Download Page 199](http://html.mh-extra.com/html/hp/nonstop-sql-mp/nonstop-sql-mp_programming-manual_165149199.webp)
HP NonStop SQL/MP Programming Manual for C—429847-008
10-1
10
Dynamic SQL Operations
Dynamic SQL allows a host-language program to construct, compile, and run all or part
of an SQL statement at run time. A dynamic SQL program uses a character host
variable as a placeholder for the SQL statement, which is usually unknown or
incomplete until run time. To construct the dynamic SQL statement in the host variable,
the program usually requires some input from a user at a terminal or workstation.
Uses for Dynamic SQL
Dynamic SQL programs can be useful in these situations:
New user interface––You need to develop an interactive design for a specific user.
For example, you might want to provide a graphical user interface (GUI) or restrict
the SQL commands a user can run.
A dynamic SQL program can be similar to SQLCI, requiring the user to know SQL
syntax to formulate a complete SQL statement. A dynamic SQL program can also
prompt the user for input, so that the user does not have to know any SQL syntax.
If the statement requires input parameters, the program can also prompt the user
for these values. The program can then construct the SQL statement by
concatenating these values to SQL syntax elements. For example, a program
might construct an entire SQL statement or only part of a statement, such as a
WHERE clause.
Restricted access to data––You want to restrict the access to specific columns in a
table. For example, your program might include a dynamic SELECT statement that
accesses specific columns in a table but not other columns (such as the columns
for an employee’s salary or home phone number).
Client-server support––You need to develop a server that receives requests from
client applications. For example, an application on a personal computer wants to
access an SQL/MP database. The PC application formulates an SQL statement
and sends it to your program over a communications protocol. Your program
constructs, compiles, and runs the dynamic SQL statement, and then sends the
results back to the PC application. (An example of a server that uses dynamic SQL
is the HP NonStop ODBC Server.)
Summary of Contents for NonStop SQL/MP
Page 4: ......
Page 14: ...Contents HP NonStop SQL MP Programming Manual for C 429847 008 x ...
Page 60: ...Host Variables HP NonStop SQL MP Programming Manual for C 429847 008 2 26 VARCHAR Data Type ...
Page 294: ...SQL MP Sample Database HP NonStop SQL MP Programming Manual for C 429847 008 A 6 ...