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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Interfacing with RDBMS stored procedures<br />

Example 19 shows passing the handles of empty dynamic temp-tables to enable a MS<br />

<strong>SQL</strong> <strong>Server</strong> <strong>Data</strong><strong>Server</strong> to create schema based on the result-set schema.<br />

/ *Calling a stored procedure, and using the EXTENT phrase to pass handles of<br />

empty temp-tables to enable the MS <strong>SQL</strong> <strong>Data</strong><strong>Server</strong> to create schema holder<br />

definitions based on each temp-table’s result-set schema. */<br />

DEFINE VARIABLE ttCustomer AS HANDLE NO-UNDO.<br />

DEFINE VARIABLE ttHandle AS HANDLE NO-UNDO EXTENT 2.<br />

DEFINE VARIABLE ttOrder AS HANDLE NO-UNDO.<br />

CREATE TEMP-TABLE ttCustomer.<br />

CREATE TEMP-TABLE ttOrder.<br />

ttHand1e[1] = ttCustomer.<br />

ttHand1e[2] = ttOrder.<br />

RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO ttHandle<br />

(“Select * from customer; select * from order”).<br />

Example 19: Calling a stored procedure and using the EXTENT phrase<br />

Example 20 shows how to use the enhanced stored procedure syntax with a single<br />

static temp-table and the send-sql-statement.<br />

/* Calling an enhance stored procedure with a single temp table and the<br />

send-sql-statement */<br />

DEFINE VARIABLE ttHandle AS HANDLE NO-UNDO.<br />

DEFINE TEMP-TABLE ttHandle<br />

FIELD f1 AS INTEGER<br />

FIELD f2 AS CHARACTER.<br />

ttHandle = TEMP-TABLE ttHandle:HANDLE.<br />

RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO ttHandle<br />

(“Select cust_num,name from customer”).<br />

Example 20: Calling an enhanced stored procedure with a single temp table<br />

and the send-sql-statement<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> 149

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

Saved successfully!

Ooh no, something went wrong!