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

From: SCassidy(at)overlandstorage(dot)com
To: "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: a stored procedure ..with integer as the parameter
Date: 2005-10-21 15:48:36
Message-ID: OFA4F5731F.E502DA63-ON882570A1.0056C7DB-882570A1.0056D933@overlandstorage.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)ahuja(at)iiitb(dot)ac To: <pgsql-general(at)postgresql(dot)org>
.in> cc:
Sent by: Subject: [GENERAL] a stored procedure ..with integer as the parameter

|-------------------|
pgsql-general-owner(at)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
----------------------------------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Franck Coppola 2005-10-21 16:01:12 How to cluster Postgresql
Previous Message Michael Fuhr 2005-10-21 15:45:06 Re: insert a value into a table