@@ -65,7 +65,7 @@ describe('43. plsqlBinding.js', function() {
65
65
} ) ;
66
66
} )
67
67
68
- it ( '43.1.1 binding PL/SQL indexed table IN' , function ( done ) {
68
+ it ( '43.1.1 binding PL/SQL indexed table IN by name ' , function ( done ) {
69
69
async . series ( [
70
70
function ( callback ) {
71
71
var proc = "CREATE OR REPLACE PACKAGE\n" +
@@ -139,7 +139,77 @@ describe('43. plsqlBinding.js', function() {
139
139
] , done ) ;
140
140
} ) ;
141
141
142
- it ( '43.1.2 binding PL/SQL indexed table IN OUT' , function ( done ) {
142
+ it ( '43.1.2 binding PL/SQL indexed table IN by position' , function ( done ) {
143
+ async . series ( [
144
+ function ( callback ) {
145
+ var proc = "CREATE OR REPLACE PACKAGE\n" +
146
+ "oracledb_testpack\n" +
147
+ "IS\n" +
148
+ " TYPE stringsType IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;\n" +
149
+ " TYPE numbersType IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;\n" +
150
+ " PROCEDURE test(s IN stringsType, n IN numbersType);\n" +
151
+ "END;" ;
152
+ connection . should . be . ok ;
153
+ connection . execute (
154
+ proc ,
155
+ function ( err ) {
156
+ should . not . exist ( err ) ;
157
+ callback ( ) ;
158
+ }
159
+ ) ;
160
+ } ,
161
+ function ( callback ) {
162
+ var proc = "CREATE OR REPLACE PACKAGE BODY\n" +
163
+ "oracledb_testpack\n" +
164
+ "IS\n" +
165
+ " PROCEDURE test(s IN stringsType, n IN numbersType)\n" +
166
+ " IS\n" +
167
+ " BEGIN\n" +
168
+ " IF (s(1) IS NULL OR s(1) <> 'John') THEN\n" +
169
+ " raise_application_error(-20000, 'Invalid s(1): \"' || s(1) || '\"');\n" +
170
+ " END IF;\n" +
171
+ " IF (s(2) IS NULL OR s(2) <> 'Doe') THEN\n" +
172
+ " raise_application_error(-20000, 'Invalid s(2): \"' || s(2) || '\"');\n" +
173
+ " END IF;\n" +
174
+ " END;\n" +
175
+ "END;" ;
176
+ connection . should . be . ok ;
177
+ connection . execute (
178
+ proc ,
179
+ function ( err ) {
180
+ should . not . exist ( err ) ;
181
+ callback ( ) ;
182
+ }
183
+ ) ;
184
+ } ,
185
+ function ( callback ) {
186
+ var bindvars = [
187
+ { type : oracledb . STRING , dir : oracledb . BIND_IN , val : [ 'John' , 'Doe' ] } ,
188
+ { type : oracledb . NUMBER , dir : oracledb . BIND_IN , val : [ 8 , 11 ] }
189
+ ] ;
190
+ connection . execute (
191
+ "BEGIN oracledb_testpack.test(:1, :2); END;" ,
192
+ bindvars ,
193
+ function ( err , result ) {
194
+ should . not . exist ( err ) ;
195
+ // console.log(result);
196
+ callback ( ) ;
197
+ }
198
+ ) ;
199
+ } ,
200
+ function ( callback ) {
201
+ connection . execute (
202
+ "DROP PACKAGE oracledb_testpack" ,
203
+ function ( err ) {
204
+ should . not . exist ( err ) ;
205
+ callback ( ) ;
206
+ }
207
+ ) ;
208
+ }
209
+ ] , done ) ;
210
+ } ) ;
211
+
212
+ it ( '43.1.3 binding PL/SQL indexed table IN OUT' , function ( done ) {
143
213
async . series ( [
144
214
function ( callback ) {
145
215
var proc = "CREATE OR REPLACE PACKAGE\n" +
@@ -212,7 +282,7 @@ describe('43. plsqlBinding.js', function() {
212
282
] , done ) ;
213
283
} ) ;
214
284
215
- it ( '43.1.3 binding PL/SQL indexed table OUT' , function ( done ) {
285
+ it ( '43.1.4 binding PL/SQL indexed table OUT' , function ( done ) {
216
286
async . series ( [
217
287
function ( callback ) {
218
288
var proc = "CREATE OR REPLACE PACKAGE\n" +
@@ -487,9 +557,8 @@ describe('43. plsqlBinding.js', function() {
487
557
"BEGIN oracledb_testpack.test4(:1); END;" ,
488
558
bindvars ,
489
559
function ( err , result ) {
490
- should . exist ( err ) ;
491
- ( err . message ) . should . startWith ( 'ORA-06550' ) ; // this causes a PL/SQL syntax error
492
- should . not . exist ( result ) ;
560
+ should . not . exist ( err ) ;
561
+ should . exist ( result ) ;
493
562
done ( ) ;
494
563
}
495
564
) ;
0 commit comments