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%20Matt's gravatar image

Siger Matt
accept rate: 13%


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...

(11 Feb '11, 00:03) Tyson Lewis

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.

(11 Feb '11, 08:36) Volker Barth

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 :)

(11 Feb '11, 20:52) Breck Carter
Comment Text Removed

@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 ;)

(11 Feb '11, 21:56) Siger Matt

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.

(15 Feb '11, 21:28) Tyson Lewis
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 Feb '11, 19:49

question was seen: 1,053 times

last updated: 10 Feb '11, 19:49