Re: Deletion - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Deletion
Date
Msg-id 53FE1072.4020602@aklaver.com
Whole thread Raw
In response to Deletion  (Ramesh T <rameshparnanditech@gmail.com>)
Responses Re: Deletion  (Ramesh T <rameshparnanditech@gmail.com>)
List pgsql-general
On 08/27/2014 08:24 AM, Ramesh T wrote:
> any help...

Honestly, this is basic programming/scripting. I would suggest picking
up an introductory programming book to get the basics down.
In the meantime, you have used a parameter variable ($1) with out
actually supplying a parameter. So Postgres has no idea what $1
represents. Either hard code the part.custid value i.e part.custid = 1
or find a way to supply the value. How you do that is going to depend on
how you are going to use the script and where you are expecting to pull
the value from.

> thanks,
> ram
>
>
> On Wed, Aug 27, 2014 at 3:22 PM, Ramesh T <rameshparnanditech@gmail.com
> <mailto:rameshparnanditech@gmail.com>> wrote:
>
>     Hi,
>                  I have deletion script to delete particular cust from
>     database.I was saved a file name with custde.sql.i need to run from
>     command line like putty tool..But have a problem
>
>     example :
>
>     delete from part where part.custid=$1;
>
>     when i ran custde.sql from putty tool
>
>     db=#\i custde.sql
>
>     it's return error
>       psql:custde.sql:9: ERROR:  there is no parameter $1
>     LINE 1: ..._ID from part where  part.CUST_ID = $1);
>
>     please let me know how to run script ..and how to give parameter..
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: swaroop
Date:
Subject: Issue with COPY command
Next
From: David G Johnston
Date:
Subject: Re: Deletion