I run into this error message every now and then. Each time I think, "I wonder if I have too many or too few?" It would be helpful if the error message was more specific, such as "Expected 2 parameters and received 3" or "Expected 3 parameters and received 2." Even "Received more parameters than expected" or "Received fewer parameters than expected" would be helpful. asked 10 Feb '11, 19:49 Siger Matt |
There is a bit of a caveat with this idea. Some parameters can be declared with a DEFAULT, which means that the "expected" number of parameters is not constant. I might also venture to say that you still need to look at the prototype for the function/procedure if you don't have the parameters right (even if you're informed that 1 is missing, it could be dangerous to guess as to what it is).
Just my 2 cents...
I agree with Tyson's opinion - when that message comes up, I usually have to compare parameters and arguments one by one for any incompatibility.
Ach, young people today don't know how easy they have it! When I was their age all syntax error messages said the same thing: ERROR IN ABOVE PROGRAM :)
@Tyson and @Volker, yes but even with the defaults would it not narrow things down significantly to know whether the procedure received too many or too few? @Breck - Anymore it takes about 5 minutes for what you just recently didn't have to be not good enough anymore ;)
Absolutely, considering defaults you could potentially say that between x and y parameters are expected. <x would="" indicate="" too="" few="" and="">y would indicate to many, but I still think it necessary to look at the procedure/function if the error were to be returned. Now, on another hand it could be nice to get an error message along the lines of "Expected parameters: date_of_event timestamp, meeting_room integer, comment varchar", but likely not practical or suited for a production environment.