Skip to main content

MySQL Stored Procedure Error

In our project we had many many stored procedures and many parameters passes to those sps. But in only one sp it gives error message something like this;

"Incorrect number of arguments for PROCEDURE sproc_t_l_Contract_Select_BySearchCriteria; expected 3, got 2”

Work long time on this sp but coudnt find it. So i tried to write it again from the begining. In this time it was work perfectly.This problem occurs because of the space between data type and its length.

Ex.
pName varchar(50) - working
pName varchar (50) - Not working

But it does not mention syntax error or something.So this error message make us vulnerable.

Comments

Ed said…
Same thing happened to me. I have a standard of declaring parameters e.g.: varchar( 50 ), for readability purposes. Of course this works fine in mysql. It also works fine when calling from php. However, it barfs when calling from .NET. Thank God I found your post, as I was tearing my hair out. It didn't occur to me to re-examine the procedure declaration.

Popular posts from this blog

tablediff command line utility in SQL Server

Above tablediff utility is very useful for comparing tables.It is not only tells us which records / columns are different but can also generate a SQL script to update the second table to make it the same as the first table. You have to navigate to following path the use this utility SELECT 'C:\Program Files\Microsoft SQL Server\100\COM> Then type command ; tablediff –? Then it shows all the options as follows   But only limitation is you could compare one table at a time. Even though you can do some interesting work to overcome this. That is Just go to the SQL sever and type following command execute it. So it will generate the script for all the table. Then you can add it into .bat file. SELECT 'C:\Program Files\Microsoft SQL Server\100\COM>tablediff -sourceserver "SourceDBName" -sourcedatabase "T1" -sourcetable ' + '"' + name +'" ' + '-destinationserver "DestinationDBName" -destinationdataba...

Dead Code Problem

Problem Actually this problem occurred when i was doing integration two projects. [Phase1 and phase2 of a project] . Phase 2 is developed on top of the phase1. Parallel phase1 had changed lot . Mean time those were working on phase2 has commented existing phase 1 code without comments . Phase 1 and phase 2 merged with some conflicts. So we commented such places with the descriptive comment . After merged the result code base has merged those phase 2 commented parts. Also there was some of already dead code in phase 1. So it is difficult to understand weather this is actual dead code or commented one from phase 2. Mistake Had left dead dead code and missing comments . Lesson learned Normally developers leave dead code in their original code with the mind of future purpose. But this not a good habit to continue.As long as you use source control ,earlier code may exist. Problem will occur if you are not using such version control. In such a situation you can keep dead code with des...