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