Microsoft Knowledge Base Email Alertz

(229757) - When using the Microsoft Oracle OLEDB provider it is possible that you may receive the following error message: ORA-06502: PL/SQL: numeric or value error ORA-06512: at TNT.PACK_TEST, line 19 ORA-06512: at line 1 This error message can occur when you...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 229757 - Last Review: October 17, 2003 - Revision: 2.0

FIX: Oracle OLEDB Provider Returns Err: "ORA06502: PL/SQL..."

This article was previously published under Q229757

On This Page

SYMPTOMS

When using the Microsoft Oracle OLEDB provider it is possible that you may receive the following error message:
ORA-06502: PL/SQL: numeric or value error ORA-06512: at "TNT.PACK_TEST", line 19 ORA-06512: at line 1
This error message can occur when you are attempting to return a character string of more than 4001 characters from a call to an Oracle stored procedure.

RESOLUTION

To work around this problem, please use the Microsoft ODBC for Oracle driver instead of the OLEDB provider.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem was corrected in the MS OLEDB Provider for Oracle found in MDAC 2.6 or later.

MORE INFORMATION

Steps to Reproduce Behavior

You can reproduce this problem by running the code that follows. You will need to modify the connection string in the code to point to your Oracle database.
   Private Sub Command1_Click()
    
   Dim cmd As ADODB.Command
   Set cmd = New ADODB.Command
    
   Dim cn As ADODB.Connection
   Set cn = New ADODB.Connection
   With cn
      .ConnectionString = "Provider=MSDAORA.1;User ID=Demo;Data Source=<your oracle server alias>;Persist Security Info=False;password=demo"
      'Uncomment the following line to make this work.
      '.ConnectionString = "Provider=MSDASQL;User ID=Demo;Data Source=<your datasource name>;Persist Security Info=False;password=demo"
       .ConnectionTimeout = 10
       .CursorLocation = adUseClient
       .Open
   End With
    
   'Create the stored procedure for testing.
   Set cmd.ActiveConnection = cn
   With cmd
       .CommandType = adCmdText
       .CommandText = "Create or Replace Procedure TEST " & _
                      " (inParam in  varchar2," & _
                      " outParam out varchar2)" & _
                      " is " & _
                      " begin " & _
                      " outParam:= inParam;" & _
                      " end ;"

   End With
   cmd.Execute
    
   Debug.Print "Stored Proc Created"
    
   Set cmd = Nothing
   Set cmd = New ADODB.Command
   With cmd
        Set .ActiveConnection = cn
        .CommandType = adCmdStoredProc
        .CommandText = "TEST"
        .Parameters.Append .CreateParameter("inParam", adLongVarChar, adParamInput, 5000, String(4002, "c"))  '<<4001 works , 4002 fails
        .Parameters.Append .CreateParameter("outParam", adLongVarChar, adParamOutput, 5000, "")
        .Execute  '<<fails here with the Oracle OLEDB provider
           
    End With
    Debug.Print i & "   Output Parameter: " & Len(cmd(1).Value)

End Sub
				

APPLIES TO
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
Keywords: 
kbbug kbfix kbmdac250fix kbmdacnosweep kboracle kbprovider KB229757
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate