Oracle "SQL Error: Missing IN or OUT parameter at index:: 1"
I have an Oracle script that looks like the following:
variable L_kSite number;
variable L_kPage number;
exec SomeStoredProcedureThatReturnsASite( :L_kSite );
exec SomeStoredProcedureThatAddsAPageToTheSite( :L_kSite, :L_kPage );
update SiteToPageLinkingTable
set HomePage = 1
where kSite = :L_kSite and kPage = :L_kPage;
Supposedly the last statement is a valid use of a bind variable but when I try to run the script I get this on the last line:
SQL Error: Missing IN or OUT parameter at index:: 1
I'm not sure how to proceed here as I'm not especially proficient in Oracle.
I had a similar error on my side when I was using JDBC in Java code.
According to this website (the second awnser) it suggest that you are trying to execute the query with a missing parameter.
For instance :
exec SomeStoredProcedureThatReturnsASite( :L_kSite );
You are trying to execute the query without the last parameter.
Maybe in SQLPlus
it doesn't have the same requirements, so it might have been a luck that it worked there.
Based on the comments left above I ran this under sqlplus instead of SQL Developer and the UPDATE statement ran perfectly, leaving me to believe this is an issue in SQL Developer particularly as there was no ORA error number being returned. Thank you for leading me in the right direction.
I think its related with jdbc.
I have a similar problem (missing param) when I have a where condition like this:
a = :namedparameter and b = :namedparameter
It's ok, When I have like this:
a = :namedparameter and b = :namedparameter2 (the two param has the same value)
So it's a problem with named parameters. I think there is a bug around named parameter handling, it looks like if only the first parameter get the right value, the second is not set by driver classes. Maybe its not a bug, only I don't know something, but anyway I guess that's the reason for the difference between the SQL dev and the sqlplus running for you, because as far as I know SQL developer uses jdbc driver.