ストラドプロシージャの呼び出し方

Similar documents
untitled

橡実践Oracle Objects for OLE

Microsoft Word - 430_15_Developing_Stored_Procedure.doc

1 SQL Server SQL Oracle SQL SQL* Plus PL/SQL 2 SQL Server SQL Server SQL Oracle SQL SQL*Plus SQL Server GUI 1-1 osql 1-1 Transact- SQL SELECTFROM 058

tkk0408nari

JavaScript の使い方

JDBCアクセス

PowerPoint -O80_REP.PDF

~~~~~~~~~~~~~~~~~~ wait Call CPU time 1, latch: library cache 7, latch: library cache lock 4, job scheduler co

Actual ESS Adapterの使用について

Introduction Purpose This training course describes the configuration and session features of the High-performance Embedded Workshop (HEW), a key tool

1 ex01.sql ex01.sql ; user_id from (select user_id ;) user_id * select select (3+4)*7, SIN(PI()/2) ; (1) select < > from < > ; :, * user_id user_name

Ver.1 1/17/2003 2

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200,

データベース認識Webサービス

※サンプルアプリケーションを固めたファイル(orcasample

AN 100: ISPを使用するためのガイドライン

Oracle Lite Tutorial

日本オラクル株式会社

untitled

"CAS を利用した Single Sign On 環境の構築"


PowerRDBconnector説明書(SQLServer編)

FileMaker ODBC and JDBC Guide

橡j_Oracle_whitepaper.PDF

CAC

Microsoft Word - Win-Outlook.docx

9iAS_DEV.PDF

TopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç..

com.ibm.etools.egl.jsfsearch.tutorial.doc.ps


Oracle Lite Tutorial

25 II :30 16:00 (1),. Do not open this problem booklet until the start of the examination is announced. (2) 3.. Answer the following 3 proble

Gartner Day

PostgreSQL カンファレンス 2013 証券取引バックオフィスにおける Oracle から PostgreSQL への マイグレーション SBI ジャパンネクスト証券株式会社 イアン バーウィック

1,.,,,., RDBM, SQL. OSS,, SQL,,.

00_1512_SLIMLINE_BOOK.indb

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

RX600 & RX200シリーズ アプリケーションノート RX用仮想EEPROM


_02-4.ppt

MySQL5.0データベース ログファイルおよびステータスの収集


untitled

FileMaker 15 ODBC と JDBC ガイド


listings-ext

_02_3.ppt

_IMv2.key

ODBC を使って MS SQL の ISE 2.1 を設定する

Warehouse Builderにおける予測分析の使用

KWCR3.0 instration

はじめに

206“ƒŁ\”ƒ-fl_“H„¤‰ZŁñ

Oracle9i JDeveloperによるWebサービスの構築

MOTIF XF 取扱説明書

FileMaker 16 ODBC と JDBC ガイド

意外と簡単!?

syspro-0405.ppt

Q&A集

,,,,., C Java,,.,,.,., ,,.,, i

. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr

第3回_416.ppt

Oracle Developer Release 6i

PowerPoint プレゼンテーション

DB12.1 Beta HandsOn Seminar

Oracle Rdb: PowerPoint Presentation

Microsoft Word - Lab6.doc

10-C.._241_266_.Z

CodeIgniter Con 2011, Tokyo Japan, February

Pari-gp /7/5 1 Pari-gp 3 pq

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac

Oracle Spatial

Microsoft Word - Android_SQLite講座_画面800×1280

Microsoft Word - D JP.docx

052-XML04/fiÁ1-part3-’ÓŠ¹

2

fiš„v3.dvi

Oracle Rdb: SQL Update

Chapter

[Lab 2]Oracleからの移行を促進する新機能

TM-T88VI 詳細取扱説明書

untitled

JOURNAL OF THE JAPANESE ASSOCIATION FOR PETROLEUM TECHNOLOGY VOL. 66, NO. 6 (Nov., 2001) (Received August 10, 2001; accepted November 9, 2001) Alterna

AtCoder Regular Contest 073 Editorial Kohei Morita(yosupo) A: Shiritori if python3 a, b, c = input().split() if a[len(a)-1] == b[0] and b[len(

浜松医科大学紀要

Introduction Purpose The course describes library configuration and usage in the High Performance Embedded Workshop (HEW), which speeds development of

XML Consortium & XML Consortium 1 XML Consortium XML Consortium 2

TopLink È... 3 TopLink...5 TopLink åø... 6 TopLink å Workbench O/R ~... 8 Workbench À ~... 8 Foundation Library å... 8 TopL

netcdf

Axiom_AIR_49_-_UserGuideJP_-_v1.0


JJ-90

Studies of Foot Form for Footwear Design (Part 9) : Characteristics of the Foot Form of Young and Elder Women Based on their Sizes of Ball Joint Girth

FileMaker ODBC and JDBC Guide

Microsoft Word - j201drills27.doc

Oracle9iAS Single Sign-On サードパーティ製品との統合

IT 2

Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: Using con

Transcription:

Release10.5 Oracle DataServer Informix MS SQL NXJ SQL JDBC Java JDBC NXJ : NXJ JDBC / NXJ EXEC SQL [USING CONNECTION <connection-name>] CALL [<schema-name>.][<package-name>.]<function-name> ([<argument-list>]) [RETURNING <return-variable> ] [INTO <result-set> <object-array> <variable-list> ( ; EXECUTING <code-statements> ) ] 1

1 CALL (1 of 2) USING CONNECTION <connection-name> CALL [<schema-name>.][<package-name>.]<function-name> Oracle <argument-list> IN Java OUT IN OUT RETURNING <return-variable> RETURNING <return- variable> INTO Informix RETURNING INTO 2

1 CALL (2 of 2) INTO <result-set> <object-array> <variable-list> INTO <object-array> <variable-list> EXECUTING INTO <resultset> EXECUTING INTO EXEC SQL ITERATE <result-set> INTO <result-set> RETURNING <return-variable> INTO Object[] EXECUTING Object[] Object[] NXJ Object[] 0 1 1 2 1 1 2 2 EXECUTING <code-statements> INTO <variable-list> EXECUTING Oracle JDBC / OUT OUT RETURN <result-set> OUT EXECUTING 3

OUT OUT : Process RETURN INTO <variable list> //stock_price is an AMOUNT field type // or a variable // function that has one IN (NUMERIC) and output // cursor with 3 columns // String, Amount and Date EXEC SQL CALL hr.sp_get_stocks(stock_price) INTO ric,price,spupdated EXECUTING // populating single multi_valued field nraise // a non-target selected set // on Data View dataview1 dataview1.cleartoadd(); dataview1.nraise = ric + " " + price.tostring() + " " + spupdated.tostring(); dataview1.updatecurrentrecord(); CREATE OR REPLACE FUNCTION "HR"."SP_GET_STOCKS" (v_price IN NUMBER) RETURN Types.ref_cursor AS stock_cursor types.ref_cursor; BEGIN OPEN stock_cursor FOR SELECT ric,price,updated FROM stock_prices WHERE price < v_price; RETURN stock_cursor; END; 4

: IN OUT EXEC SQL CALL HR.EMPLOYEE_PKG.GetEmployeeDetails (1,em_first_name,em_last_name,em_salary,em_start_date); session.displaytomessagebox("response: " + em_first_name + " " + em_last_name + " " + em_salary + " " + em_start_date); IN OUT PROCEDURE GetEmployeeDetails( i_emid INemployee.em_id%TYPE, o_firstname OUT employee.em_first_name%type, o_lastnameoutemployee.em_last_name%type, o_salaryoutemployee.em_salary%type, o_startdateoutemployee.em_start_date%type) IS BEGIN SELECT em_first_name, em_last_name, em_salary, em_start_date INTO o_firstname, o_lastname, o_salary, o_startdate FROM employee WHERE em_id = i_emid; END GetEmployeeDetails; ITERATE OUT 1 EXEC SQL ITERATE <resultset-variable-name> INTO (<variable-list> <object-array>) ( ; 5

EXECUTING <code-statements> ) 2 1 CALL ITERATE RETURNING <result-set> // Variables defined on Form // NullableStringVariable ric; // NullableAmountVariable price; // NullableDateVariable spupdated; // Declare ResultSet rs for RETURNING ResultSet rs; EXEC SQL CALL HR.sp_get_stocks(stock_price) RETURNING rs; // Iterate through the returned result set EXEC SQL ITERATE rs INTO ric,price,spupdated EXECUTING // populating single multi_valued field nraise // a non-target selected set // on Data View dataview1 dataview1.cleartoadd(); dataview1.nraise = ric + " " + price.tostring() + " " + spupdated.tostring(); dataview1.updatecurrentrecord(); 6

OUT Oracle INDEX BY TABLE IN OUT Dynamic NXJ Javadoc NXJParameter INDEX BY TABLE OUT Oracle OCI JDBC OCI Oracle : Type: Other JDBC Databases Jar/Zip File: C: Unify NXJ lib jdbcdrivers ojdbc14.zip User Name: xxxxx Password : xxxx Driver: odbc.jdbc.driver.oracledriver URL: jdbc:oracle:oci:@servername servername Oracle Network Client PREPARE CALL PREPARE CALL EXEC SQL [ USING CONNECTION <connection-name> ] PREPARE CALL <string-expression> INTO <NXJPreparedCall>; 7

2 PREPARE CALL USING CONNECTION <connection-name> CALL <string-expression> INTO <NXJPreparedCall> NXJPreparedCall NXJPreparedCall mycall; EXEC SQL USING CONNECTION ocioracle PREPARE CALL "HR.EMPLOYEE_PKG.GetEmployeeList" INTO mycall; EXEC SQL EXECUTE registerindextableoutparameter() OUT PL/SQL OUT EXEC SQL EXECUTE SQLException // Get the NXJ Parameters for the prepared call NXJParameter[] params = mycall.getoutputparameterdata(); // you must register the estimated array size // value for each parameter in this example there are 3 OUT parameters. params[0].registerindextableoutparameter(100); 8

params[1].registerindextableoutparameter(100); params[2].registerindextableoutparameter(100); EXECUTE OUT EXEC SQL EXECUTE <NXJPreparedCall> [ USING (<input-object-array> <expression-list>) [ RETURNING (<result-set> <output-object-array. <variable-list>) ; 3 EXECUTE EXECUTE <NXJPreparedCall> NXJPreparedCall USING (<input-object-array> <expression-list>) IN Object[] IN 1 IN 1 INTO (<result-set> <output-object-array> <variable-list>) OUT OUT 1 9

Object[] NXJ OUT Object[] 0 1 OUT 1 2 OUT OUT PREPARE // Package TYPE tblemid IS TABLE OF NUMBER(3)INDEX BY BINARY_INTEGER; TYPE tblfirstname IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER; TYPE tbllastname IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER; TYPE tblsalary IS TABLE OF NUMBER(6) INDEX BY BINARY_INTEGER; TYPE tblstartdate IS TABLE OF DATE INDEX BY BINARY_INTEGER; PROCEDURE GetEmployeeList( o_emid OUT tblemid, o_firstname OUT tblfirstname, o_lastnameouttbllastname) // Package Body PROCEDURE GetEmployeeList( o_emid OUT tblemid, o_firstnameout tblfirstname, o_lastnameouttbllastname) IS CURSOR employee_cur IS SELECT em_id,em_first_name, em_last_name FROM employee; reccount NUMBER DEFAULT 0; BEGIN FOR EmployeeRec IN employee_cur LOOP reccount:= reccount + 1; o_emid(reccount):= EmployeeRec.em_id; o_firstname(reccount):= EmployeeRec.em_first_name; o_lastname(reccount):= EmployeeRec.em_last_name; END LOOP; END GetEmployeeList; 10

EXEC SQL PREPARE CALL NXJ // using TABLE INDEX BY return values: // i.e. TYPE tblemid IS TABLE OF NUMBER(3)INDEX BY BINARY_INTEGER; // NOTE: Oracle TABLE INDEX BY requires the OCI JDBC connection // which requires the Oracle Client be installed on the // Application Server. // Configuration is: // Type: Other JDBC Databases // Jar/Zip File: C: Unify NXJ lib jdbcdrivers ojbdbc14.jar // User Name: xxxxx Password : xxxx // Driver: odbc.jdbc.driver.oracledriver // URL: jdbc:oracle:oci:@servername // NOTE: This server MUST be configured in the Oracle Network // Client // Define the NXJ Prepared Call NXJPreparedCall call; EXEC SQL USING CONNECTION ocioracle PREPARE CALL "HR.EMPLOYEE_PKG.GetEmployeeList" into call; // Get the NXJ Parameters for the prepared call NXJParameter[] params = call.getoutputparameterdata(); // you must register the estimated array size // value for each parameter params[0].registerindextableoutparameter(100); params[1].registerindextableoutparameter(100); params[2].registerindextableoutparameter(100); // Define variables for the return values int[] firstarray; String[] secondarray; String[] thirdarray; // Execute the call EXEC SQL EXECUTE call RETURNING firstarray, secondarray, thirdarray; // Loop through the returned arrays and in this example // add them to a selected set. for (int i = 0; i < firstarray.length; i++) testview1.cleartoadd(); testview1.nraise = secondarray[i] + " " + thirdarray[i]; 11

testview1.updatecurrentrecord(); // Close the prepared call call.close(); NXJPreparedCall NXJParameter NXJ NXJPrepreparedCall NXJPreparedCall Void close() : NXJPrepareCall sp_call; Sp_call.close(); NXJParameter[] getinputparameterdata NXJParameter[] getinputparameterdata() throws SQLException; : NXJParameter[] params = call.getinputparameterdata(); 12

NXJParameter[] getoutputparameterdata NXJParameter[] getoutputparameterdata() throws SQLException; getvendorreturncode() hasvendorreturncode() hasvendorreturncode() boolean hasvendorreturncode(); NXJPreparedCall true getvendorreturncode () int getvendorreturncode(); hasvendorreturncode() false IllegalStateException NXJParameter String getname(); - int getsqltype(); 13

- java sql int getextendedtype(); NXJExtendedSQLType.NOT_EXTENDED String gettypename(); - int getlength(); - intgetnullable(); - 1 NXJParameter.NO_NULLS NXJParameter.NULLABLE NXJParameter.NULLABLE_UNKNOWN intgetprecision(); - shortgetradix(); - shortgetscale(); - Oracle PL/SQL OUT PL/SQL OUT NXJParameter.getExtenedType() NXJExtentedSQLTypes.INDEX_BY_TABLE int getindextableelemsqltype(); - sql int getindextableelemmaxlen(); 14

- sql VARCHAR, CHAR, BINARY 0 registeroraclearrayoutparameter registeroraclearrayoutparameter() OUT Oracle Oracle Array User Types-> Array Types : outputparameterdata[0].registeroraclearrayoutparameter("my_array"); registerindextableoutparameter registerindextableoutparameter() NXJParameter.getExtenedType() NXJExtentedSQLTypes.INDEX_BY_TABLE OUT NXJ EXEC SQL EXECUTE OUT SQLException void registerindextableoutparameter( int maxlen ); int maxlen - NXJParameter Javadoc NXJ SQL NXJParameter.getExtendedType() NOT_EXTENDED - NXJParameter NXJ SQL NXJParameter.getSqlType() RESULT_SET - NXJParameter ResultSet INDEX_BY_TABLE 15

- NXJParameter Oracle PL/SQL : NXJPreparedCall sp_call; EXEC SQL USING CONNECTION ocioracle PREPARE CALL "HR.EMPLOYEE_PKG.GetEmployeesAboveSalary" INTO sp_call; NXJParameter[] inparams = sp_call.getinputparameterdata(); session.displaytomessagebox("input: " + inparams[0].getsqltype()); NXJParameter[] outparams = sp_call.getoutputparameterdata(); for (int index = 0; index < outparams.length; index++) NXJParameter outparam1 = outparams[index]; session.displaytomessagebox(" OUT: " + param1.getname() + " Type: " + outparam1.getindextableelemsqltype()); if (outparam1.getextendedtype() == com.unify.nxj.mgr.dataconnection.nxjextendedsqltypes.index_by_table) outparam1.registerindextableoutparameter(1000); // Define variables for the return values int[] o_emid; int myinput = 10000; String[] o_firstname; String[] o_lastname; float[] o_salary; java.sql.timestamp[] o_startdate; EXEC SQL [ USING CONNECTION <connection-name> ] GET VAR <string-expression> INTO <return-variable>; 16

4 GET VAR GET VAR <string-expression> "MY_PACKAGE.MY_VARIABLE") INTO <return-variable> EXEC SQL [ USING CONNECTION <connection-name> ] SET VAR <string-expression> USING <input-expression>; 5 SET VAR SET VAR <string-expression> "MY_PACKAGE.MY_VARIABLE" USING <input-expression> : // As defined in Oracle Package: EMPLOYEE_PKG // mystring VARCHAR2(40); String setfield = hello UNIFY ; 17

EXEC SQL SET VAR "HR.EMPLOYEE_PKG.myString" USING setfield; EXEC SQL GET VAR "HR.EMPLOYEE_PKG.myString" INTO setfield; session.displaytomessagebox(setfield); Oracle raise_application_error() Oracle raise_application_error() Oracle JDBC SQLException SQLException.getErrorCode() raise_application_error() Oracle Oracle 1 PL/SQL REF CURSOR : CREATE OR REPLACE PACKAGE types AS TYPE ref_cursor IS REF CURSOR; END; 1 SQL 1 PL/SQL 18

NXJ 2 PL/SQL 1 NXJ 2 NXJ Oracle CREATE TABLE STOCK_PRICES( RIC VARCHAR(6) PRIMARY KEY, PRICE NUMBER(7,2), UPDATED DATE ) TABLESPACE USERS / INSERT INTO STOCK_PRICES(RIC, PRICE, UPDATED) VALUES('MSFT', 69.20, SYSDATE) / INSERT INTO STOCK_PRICES(RIC, PRICE, UPDATED) VALUES('RSAS', 30.18, SYSDATE) / INSERT INTO STOCK_PRICES(RIC, PRICE, UPDATED) VALUES('AMZN', 15.50, SYSDATE) / INSERT INTO STOCK_PRICES(RIC, PRICE, UPDATED) VALUES('SUNW', 16.25, SYSDATE) / INSERT INTO STOCK_PRICES(RIC, PRICE, UPDATED) VALUES('ORCL', 14.50, SYSDATE) / COMMIT / CREATE OR REPLACE PACKAGE Types AS TYPE ref_cursor IS REF CURSOR; END; / CREATE OR REPLACE FUNCTION sp_get_stocks(v_price IN NUMBER) RETURN types.ref_cursor AS stock_cursor types.ref_cursor; BEGIN OPEN stock_cursor FOR SELECT ric,price,updated FROM stock_prices 19

WHERE price < v_price; RETURN stock_cursor; END; NXJ COMMAND sp_get_stocks //stock_price is an AMOUNT field type or a variable // Variables ric, price, and spupdated are defined as // NullableStringVariable ric; // NullableAmountVariable price; // NullableDateVariable spupdated; EXEC SQL CALL hr.sp_get_stocks(stock_price) INTO ric,price,spupdated EXECUTING session.displaytomessagebox(": " + ric + " " + price + " " + spupdated); COMMAND sp_get_stocks2 DataViewHelper.clearSet(testview1); // this is just clearing out the selected set // Define the Result Set ResultSet rs; EXEC SQL CALL HR.sp_get_stocks(stock_price) // NOTE: Can also use RETURNING rs; INTO rs; // Iterate through the returned result set EXEC SQL ITERATE rs INTO ric,price,spupdated EXECUTING testview1.cleartoadd(); testview1.nraise = ric + " " + price.tostring() + " " + spupdated.tostring(); testview1.updatecurrentrecord(); 20

Oracle INDEX_BY_TABLE : CREATE OR REPLACE PACKAGE "HR"."EMPLOYEE_PKG" AS TYPE tblemid IS TABLE OF NUMBER(3) INDEX BY BINARY_INTEGER; TYPE tblfirstname IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER; TYPE tbllastname IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER; TYPE tblsalary IS TABLE OF NUMBER(6) INDEX BY BINARY_INTEGER; TYPE tblstartdate IS TABLE OF DATE INDEX BY BINARY_INTEGER; mynumber NUMBER; mystring VARCHAR2(40); PROCEDURE GetEmployeeList( o_emid OUT tblemid, o_firstname OUT tblfirstname, o_lastname OUT tbllastname); PROCEDURE GetEmployeesAboveSalary( i_minimumsalary INemployee.em_salary%TYPE, o_emid OUT tblemid, o_firstname OUT tblfirstname, o_lastnameouttbllastname, o_salaryouttblsalary); /******************************************************************* * Retrieves a single employees details using standard arguments *******************************************************************/ PROCEDURE GetEmployeeDetails( i_emid INemployee.em_id%TYPE, o_firstname OUT employee.em_first_name%type, o_lastnameoutemployee.em_last_name%type, o_salaryoutemployee.em_salary%type, o_startdateoutemployee.em_start_date%type); 21

END Employee_Pkg; Oracle INDEX_BY_TABLE: CREATE OR REPLACE PACKAGE BODY "HR"."EMPLOYEE_PKG" AS PROCEDURE GetEmployeeList( o_emid OUT tblemid, o_firstname OUT tblfirstname, o_lastname OUTtblLastName) IS CURSOR employee_cur IS SELECT em_id,em_first_name, em_last_name FROM employee; reccount NUMBER DEFAULT 0; BEGIN FOR EmployeeRec IN employee_cur LOOP reccount := reccount + 1; o_emid(reccount) := EmployeeRec.em_id; o_firstname(reccount):= EmployeeRec.em_first_name; o_lastname(reccount) := EmployeeRec.em_last_name; END LOOP; END GetEmployeeList; PROCEDURE GetEmployeesAboveSalary( i_minimumsalary INemployee.em_salary%TYPE, o_emid OUT tblemid, o_firstname OUT tblfirstname, o_lastnameouttbllastname, o_salaryouttblsalary) IS CURSOR employee_cur (curminsalary NUMBER) IS SELECT em_id, em_first_name, em_last_name, em_salary, em_start_date FROM employee WHERE em_salary > curminsalary; reccount NUMBER DEFAULT 0; BEGIN 22

FOR EmployeeRec IN employee_cur(i_minimumsalary) LOOP reccount:= reccount + 1; o_emid(reccount) := EmployeeRec.em_id; o_firstname(reccount):= EmployeeRec.em_first_name; o_lastname(reccount) := EmployeeRec.em_last_name; o_salary(reccount) := EmployeeRec.em_salary; END LOOP; END GetEmployeesAboveSalary; /******************************************************************* * Retrieves a single employees details using standard arguments *******************************************************************/ PROCEDURE GetEmployeeDetails( i_emid INemployee.em_id%TYPE, o_firstname OUT employee.em_first_name%type, o_lastname OUTemployee.em_last_name%TYPE, o_salary OUTemployee.em_salary%TYPE, o_startdate OUTemployee.em_start_date%TYPE) IS BEGIN SELECT em_first_name, em_last_name, em_salary, em_start_date INTO o_firstname, o_lastname, o_salary, o_startdate FROM employee WHERE em_id = i_emid; END GetEmployeeDetails; END Employee_Pkg; NXJ // ********************** GetEmployeeList ********************* // Define the NXJ Prepared Call NXJPreparedCall call; EXEC SQL USING CONNECTION ocioracle PREPARE CALL "HR.EMPLOYEE_PKG.GetEmployeeList" into call; 23

// Get the NXJ Parameters for the prepared call NXJParameter[] params = call.getoutputparameterdata(); // you must register the estimated array size // value for each parameter params[0].registerindextableoutparameter(100); params[1].registerindextableoutparameter(100); params[2].registerindextableoutparameter(100); // Define variables for the return values int[] firstarray; String[] secondarray; String[] thirdarray; // Execute the call EXEC SQL EXECUTE call RETURNING firstarray, secondarray, thirdarray; // Loop through the returned arrays and in this example // add them to a selected set. for (int i = 0; i < firstarray.length; i++) testview1.cleartoadd(); testview1.nraise = secondarray[i] + " " + thirdarray[i]; testview1.updatecurrentrecord(); // Close the prepared call call.close(); //************** GetEmployeesAboveSalary ************* NXJPreparedCall sp_call; EXEC SQL USING CONNECTION ocioracle PREPARE CALL "HR.EMPLOYEE_PKG.GetEmployeesAboveSalary" into sp_call; NXJParameter[] inparams = sp_call.getinputparameterdata(); NXJParameter[] params = sp_call.getoutputparameterdata(); for (int index = 0; index < params.length; index++) NXJParameter param1 = params[index]; if (param1.getextendedtype() == com.unify.nxj.mgr.dataconnection.nxjextendedsqltypes.index_by_table) param1.registerindextableoutparameter(1000); // Define variables for the return values int[] o_emid; int myinput = 10000; String[] o_firstname; 24

String[] o_lastname; float[] o_salary; EXEC SQL EXECUTE sp_call USING myinput RETURNING o_emid,o_firstname,o_lastname,o_salary; DataViewHelper.clearSet(testview1); // Loop through the returned arrays and in this example // add them to a selected set. for (int i = 0; i < o_emid.length; i++) testview1.cleartoadd(); testview1.nraise = o_firstname[i] + " " + o_lastname[i] + " " + o_salary[i]; testview1.updatecurrentrecord(); // Close the prepared call sp_call.close(); //************** GetEmployeesList ************* NXJPreparedCall call; EXEC SQL USING CONNECTION ocioracle PREPARE CALL "HR.EMPLOYEE_PKG.GetEmployeeList" INTO call; // Get the NXJ Parameters for the prepared call NXJParameter[] params = call.getoutputparameterdata(); // you must register the estimated array size // value for each parameter for (int index = 0; index < params.length; index++) NXJParameter param1 = params[index]; if (param1.getextendedtype() == com.unify.nxj.mgr.dataconnection.nxjextendedsqltypes.index_by_table) param1.registerindextableoutparameter(1000); // Define variables for the return values int[] firstarray; String[] secondarray; String[] thirdarray; // Execute the call EXEC SQL EXECUTE call 25

RETURNING firstarray, secondarray, thirdarray; // Loop through the returned arrays and in this example // add them to a selected set. for (int i = 0; i < firstarray.length; i++) testview1.cleartoadd(); testview1.nraise = secondarray[i] + " " + thirdarray[i]; testview1.updatecurrentrecord(); // Close the prepared call call.close(); MS SQL NXJ MS SQL compute SELECT NXJ CALL RETURNING Null Null 26