23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Syntax<br />

E<strong>SQL</strong> elements and statements<br />

• The USING clauses of EXECUTE and OPEN statements identify host language storage. The<br />

values in this storage expand a statement string, replacing a substitution name or a<br />

parameter marker. You can design your program to execute the same prepared statement<br />

many times in a transaction, supplying different values for input variables for each<br />

execution. If you COMMIT or ROLLBACK the transaction, you must PREPARE the statement<br />

string again.<br />

Authorization<br />

Must have DBA privileges or authorization for the <strong>SQL</strong> statement being used.<br />

Related statements<br />

EXECUTE, OPEN, CLOSE, FETCH<br />

SET CONNECTION<br />

Switches the application from one established connection to another. This resumes the<br />

connection associated with the specified connection_name, restoring the context of that<br />

database connection to the same state it was in when suspended.<br />

SET CONNECTION { 'connection_name' | DEFAULT } ;<br />

connection_name<br />

DEFAULT<br />

The name of the connection as either a character literal or host variable. If the SET<br />

CONNECTION statement omits a connection name, the default is the name of the database.<br />

Connection names must be unique.<br />

Sets the DEFAULT connection as the current connection.<br />

Examples The first example shows how to establish a database as the current database:<br />

EXEC <strong>SQL</strong><br />

SET CONNECTION 'conn_1' ;<br />

The SET CONNECTION command sets the database associated with the connection named conn_1<br />

to the status of current database. The connection named conn_1 must be associated with an<br />

established connection. Use SET CONNECTION DEFAULT to set current the database associated<br />

with the DEFAULT connection. In this example, the statement suspends the conn_1 connection,<br />

which had been current:<br />

EXEC <strong>SQL</strong><br />

SET CONNECTION DEFAULT ;<br />

See also the last example for the DISCONNECT statement, which illustrates the CONNECT, SET<br />

CONNECTION, and DISCONNECT statements in combination.<br />

341

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!