Solved

Error passing Array to PL/SQL Package

Posted on 2003-12-02
4
1,010 Views
Last Modified: 2007-12-19
Trying to pass an array of stings into a PL/SQL package. I get the following error:

Error 3001
Arguments are of the wrong type, out of acceptable range or in conflict with one another.

Package Declaration:
Create or replace WriteSchedByArray
IS
TYPE my_Array IS varray(400) OF VARCHAR2(200);
PROCEDURE MassWriteSched(
                          SchedArray IN my_Array,
                          PercentDone OUT NUMBER
                          );
END WriteSchedByArray;


VB Code::: (ConnO is Open)
  Dim p1 As New ADODB.Parameter
  Dim p2 As New ADODB.Parameter
  Dim cCmd As ADODB.Command
  Dim y As Integer
 y = -1
   Set cCmd = New ADODB.Command
    With cCmd
      .CommandText = "schedule.writeschedbyarray.massWritesched"
      .CommandType = adCmdStoredProc
       .ActiveConnection = ConnO

*** Error is here ***
      Set p1 = .CreateParameter("ary", adArray, adParamInput, 400, arySchd(0))
*** Error is here ***

       Set p2 = .CreateParameter("PercentDone", adInteger, adParamOutput)
       .Parameters.Append p1
       .Parameters.Append p2
       .Execute


Any suggestions?
Bob
0
Comment
Question by:BobMiner
  • 2
  • 2
4 Comments
 
LVL 23

Expert Comment

by:seazodiac
ID: 9860947
I think Oracle varray index start with 1 , not 0 , different from all other programming languages.

try to change that line to this:
Set p1 = .CreateParameter("ary", adArray, adParamInput, 400, arySchd(1))
0
 

Author Comment

by:BobMiner
ID: 9861385
Thats not it.  Same error.
0
 
LVL 23

Accepted Solution

by:
seazodiac earned 500 total points
ID: 9861467
BobMiner:
I think this problem popped up before in this forum.
I found out that Passing VB array to pl/sql stored procedure does not appear to be supported.
The workaround is pass  a comma-delimited string to pl/sql stored procedure and inside pl/sql stored procedure, of course, you have to have a parsing mechanism to handle it.

you can search this site to find the solution.
0
 

Author Comment

by:BobMiner
ID: 9861849
k, thanks.  Rather annoying but workable.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question