13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

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.

Run Stored-Procedure details<br />

• “Run Stored-Proc statement execution with the LOAD-RESULT-INTO phrase”<br />

section on page 129.<br />

• “Run Stored-Proc statement execution using the send-sql-statement option”<br />

section on page 129.<br />

The following sections describe the syntax elements and options in detail. This section<br />

also presents examples that describe typical situations in which you might use the<br />

various options that the RUN STORED-PROC statement supports.<br />

Run Stored-Procedure statement<br />

The RUN STORED-PROC statement runs a RDBMS stored procedure or allows you to<br />

send Transact-<strong>SQL</strong> to a MS <strong>SQL</strong> <strong>Server</strong> based data source using an <strong>OpenEdge</strong><br />

<strong>Data</strong><strong>Server</strong>. It contains a procedure-name which is either the:<br />

• Name of the RDBMS stored procedure that you want to run<br />

• <strong>OpenEdge</strong> built-in procedure name, send–sql–statement, to send<br />

Transact-<strong>SQL</strong> to a MS <strong>SQL</strong> <strong>Server</strong> based data source<br />

Note: If your ABL procedure is in a transaction block when a RUN<br />

STORED–PROCEDURE statement is executed, the RDBMS stored procedure<br />

runs within the same RDBMS transaction, even if your stored procedure<br />

declares its own transaction levels.<br />

LOAD-RESULT-INTO phrase<br />

The LOAD-RESULT-INTO function loads the result sets into a temp-table which is<br />

represented by a handle variable. Note that handle can also be defined as extent to<br />

enable you to pass more than one temp-table handle in those instances where <strong>SQL</strong><br />

statement(s) are defined to return more than one result set.<br />

When used with the RUN STORED-PROC statement or stored procedure to load result<br />

sets into temp-tables, this function carries an implicit CLOSE-STORED PROCEDURE<br />

statement.<br />

Note: The compiler issues an error at runtime if the variable of type handle with the<br />

LOAD-RESULT-INTO function does not point to a temp-table.<br />

For additional details about using the LOAD-RESULT-INTO phrase with the temp-table<br />

handle, see the “Loading result sets into temp-tables” section on page 141.<br />

When used with the LOAD-RESULT-INTO phrase, the temp-table handle identifies the<br />

temp-table to which the result set will be loaded.<br />

You can specify an array of one or more temp-table handle elements to retrieve stored<br />

procedure result sets and have the <strong>Data</strong><strong>Server</strong> load the result set data directly into the<br />

associated temp-table(s). This approach allows you to have direct ABL access to the<br />

fields defined in the temp-table.<br />

<strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong> 125

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

Saved successfully!

Ooh no, something went wrong!