|
-
Feb 7th, 2011, 12:50 PM
#1
Thread Starter
Fanatic Member
[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.
-
Feb 7th, 2011, 01:21 PM
#2
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
-
Feb 7th, 2011, 01:30 PM
#3
Thread Starter
Fanatic Member
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
-
Feb 7th, 2011, 01:35 PM
#4
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
-
Feb 7th, 2011, 01:42 PM
#5
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|