Binding Oracle PL/SQL variable in VW2.5 
Author Message
 Binding Oracle PL/SQL variable in VW2.5

I've found that the use of named variables in PL/SQL blocks does not work as
described in the "VisualWorks Database Connect for Oracle7 User's Guide".

Let me refer to the example on page 10 of the User's Guide:

session
 preparePLSQL: 'BEGIN pkg.addstuff(:arg1, :arg2, :arg3); END;';
 bindVariable: #arg1 value: Timestamp now;
 bindVariable: #arg2 value: #('One' 'Two' Three' nil);
 bindVariable: #arg3 value: 4;
 execute;
 answer.

This will work as long as there are only three parameters in the procedure and
they are bound in POSITIONAL order.  My tests indicate that the so-called
"named binding" is actually positional binding.   This example will not work if
the order of binding is scrambled, or if an intermediate parameter is left
out.  To achieve true named binding, the code looks like this:

session
 preparePLSQL: 'BEGIN pkg.addstuff( arg1 => :arg1, arg2 => :arg2, arg3 =>
:arg3); END;';
 bindVariable: #arg1 value: Timestamp now;
 bindVariable: #arg2 value: #('One' 'Two' Three' nil);
 bindVariable: #arg3 value: 4;
 execute;
 answer.

This code has worked in my tests, and it doesn't matter what order the
variables are bound in.

Refer to the "Oracle PL/SQL User's Guide and Reference", page 6-12.

I've also tried to bind variables BEFORE preparing the PL/SQL, and I got a UHE.
 Has anyone else had problems doing this?



Thu, 29 Apr 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Database Consultant - 5 years DBA, Oracle 6 - 7.2 - 7.3, PL/SQL, UNIX, backup/recovery - NE

2. tcl, aol, oracle & return PL/SQL Table

3. Ada / SQL bindings experience with Oracle DB

4. VA & PL/SQL cursor variables

5. vw5i1 to Oracle 8 binding variable question

6. binding a variable for an sql query

7. Help [VW2.5.2] - different results: Oracle/Centura

8. Q: VW2.0 with Oracle Workgroup Server ?

9. Oracle connect VW2 WinNT

10. Anyone successfully using VW2.0 with Sybase/Oracle?

11. Anyone successfully using VW2.0 with Sybase/Oracle

12. VW2 connect to Oracle using Named Pipes (NT 3.5)

 

 
Powered by phpBB® Forum Software