Results 1 to 5 of 5

Thread: [RESOLVED] Error when to call Stored procedure

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Resolved [RESOLVED] Error when to call Stored procedure

    Hi

    I trying to call a procedure passing only parameter, but return me error when stat.
    The parameter is value of DTpickcer in format AAAAMM . plese see:

    Code:
         Set cmd = New ADODB.Command
          nAno_mes = Format(dtpAnoMes.Value, "yyyymm")
          
          Screen.MousePointer = vbHourglass
          With cmd
                 .ActiveConnection = cn
                 .CommandText = "PROCEDURE_ONE"
                 .CommandType = adCmdStoredProc
                .Parameters.Append .CreateParameter("@P_ANO_MES", adNumeric, adParamInput, nAno_mes)
                .Execute
          End With
    mY Procedure in oracle begin as:

    Code:
    create or replace procedure PROCEDURE_ONE ( P_ANO_MES in number ) is
    Error in exception VB
    Code:
     ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PROCEDURE_ONE'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    The procedure work fine when executed only, What is wrong in my code ?

    Tia
    Last edited by mutley; Feb 7th, 2011 at 01:26 PM.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Error when to call Stored procedure

    well, the thing that stands out the most is that your sproc isn't called _PROCEDURE_ONE... but P6MPR_CARGA_S901_PREVISAO - I'm hoping that's just a typo...

    The other thing that stood out to me was your parameters to the CreateParameter seems to be short one....

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

    The parameter following the direction is the SIZE... THEN the value...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Re: Error when to call Stored procedure

    Sorry , The name of procedure is PROCEDURE_ONE , but in the code VB and Oracle are equal , but not worked

    but

    Code:
        with cmd     
        .Parameters.Append .CreateParameter("@P_ANO_MES", adNumeric, adParamInput, nAno_mes)
    
        end with
    Is other mode to create and append parameter

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Error when to call Stored procedure

    Did you look at the link? The value that follows the direction is THE SIZE PARAMETER... you're passing in your value as the SIZE... not as the VALUE...
    I'll line them up for you:

    Code:
    command.CreateParameter (Name,                Type,           Direction,         Size,            Value)
                   .CreateParameter("@P_ANO_MES", adNumeric, adParamInput, nAno_mes)  'See? No value here....
    Yes, I understand the documentation says that the parameters are Optional, but you can't skip a parameter in the middle... how does VB know that nAno_mes is the value? It doesn't. It's a number, so it assumes, "hey, must be the size of the parameter, cool" and uses it.

    Try this:
    Code:
    .Parameters.Append .CreateParameter("@P_ANO_MES", adNumeric, adParamInput)
    .Parameters("@P_ANO_MES").Value = nAno_mes)
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Re: Error when to call Stored procedure

    Sorry, Sorry, 10000 Sorry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width