On Mon, 24 Oct 2005, surabhi.ahuja wrote: > from the client i receive a vector of strings ...which i have to pass as > arguments to the stored procedure. > > That stored procedure has valid arguments data types > > for instance > i have a stored procedure as follows: > > insert(integer, varchar(256), smallint) > > from the client I get : "200", "surabhi", "10" > > now i have to make a call to the stored procedure using the above received strings. > will not the "200" be converted to a valid integer before saving into > the database ..and same with the smallint values. I don't see how this example is directly related to what you sent before with an empty string. Theoretically, yes, I believe a quoted 200 ('200') and a quoted 10 ('10') should work for those two positions (unless there's a question where there's another insert function that takes different arguments that grabs it first). As an aside unquoted/uncast 10 will not currently match the smallint argument, though, so it may be better to simply not use smallint arguments. However, from your first mail, there was a question of ('') which is not a valid integer. Calling insert('200', 'surabhi', '') or insert('', 'surabhi', '10') are going to give the "invalid input syntax for integer" because an empty string doesn't match the pattern for an integer. > From: Stephan Szabo [mailto:sszabo@xxxxxxxxxxxxxxxxxxxxx] > Sent: Fri 10/21/2005 12:11 PM > To: surabhi.ahuja > Cc: pgsql-general@xxxxxxxxxxxxxx > Subject: Re: a stored procedure ..with integer as the parameter > > On Fri, 21 Oct 2005, surabhi.ahuja wrote: > > > i have a stored procedure > > > > insert_table(integer) > > which does "insert into table (x) value ($1)"; > > > > now in my client i call the stored procedure as > > > > select insert_table("3"); > > > > it works fine and inserts 3 into the table > > > > but suppose i give > > > > select insert_table(""); > > > > it gives an error ...saying " invalid input syntax for integer: " > > > > please suggest a solution to this problem > > Don't try to use an empty string as an integer? > > Seriously, you need to give information about what you want to happen, > because an empty string isn't a valid integer and can't really be > converted into one (we explicitly removed code that handled this case > because we thought it didn't make sense). > > > > > ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq