Search Postgresql Archives

Re: a stored procedure ..with integer as the parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First, you should not quote an integer value going into an integer column -
bad habit to get into.

Second, empty string is not an integer.

Susan


                                                                                                                                          
                           "surabhi.ahuja"                                                                                                
                      <surabhi.ahuja@xxxxxxxx        To:       <pgsql-general@xxxxxxxxxxxxxx>                                             
                      .in>                           cc:                                                                                  
                           Sent by:                  Subject:   a stored procedure ..with integer as the parameter               
                                                                                                                                          
                                                      |-------------------|                                                               
                      pgsql-general-owner@pos         | [ ] Expand Groups |                                                               
                      tgresql.org                     |-------------------|                                                               
                                                                                                                                          
                                                                                                                                          
                           10/20/2005 11:03                                                                                               
                      PM                                                                                                                  
                                                                                                                                          
                                                                                                                                          




 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

thanks,
reagrds
surabhi




----------------------------------------------------------------------------------------------
See our award-winning line of tape and disk-based
backup & recovery solutions at http://www.overlandstorage.com
----------------------------------------------------------------------------------------------


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux