Received: from tidal.ipinc.com (tidal.ipinc.com [199.245.188.85]) by hub.org (8.10.1/8.10.1) with ESMTP id e8MMUZs97473; Fri, 22 Sep 2000 18:30:35 -0400 (EDT) Received: from ipinc.com (jliang.ipinc.com [199.245.188.130]) by tidal.ipinc.com (8.9.3/8.9.3) with ESMTP id PAA78646; Fri, 22 Sep 2000 15:29:53 -0700 (PDT) (envelope-from jliang@ipinc.com) Message-ID: <39CBDC90.7E4700DC@ipinc.com> Date: Fri, 22 Sep 2000 15:26:24 -0700 From: Jie Liang Organization: ipinc.com X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Nelson CC: "pgsql-general@hub.org" , "pgsql-novice@hub.org" , "pgsql-sql@hub.org" Subject: Re: how to store a query, that results in a table References: <39CB65A0.9DEF7ABB@cmet.net> <39CBD205.9A922DDE@ipinc.com> <39CBD883.9A63F0C6@cmet.net> Content-Type: multipart/alternative; boundary="------------8C7B629968ACD4DCC55D510E" X-Archive-Number: 200009/187 --------------8C7B629968ACD4DCC55D510E Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, So, your question is not client side, you want store a procedure in db(server side) can accept para from client side. I have not seen Pg has a functionality to do like store procedure or package like Oracle ( maybe I don't know), so , I suggest that : 1 use embeded SQL 2. store query as a SQL in shell script( because shell script can accept parameters) in shell , you can say: echo "select * from table1 where row1=$1"|rsh pg_server /usr/local/pgsql/bin/psql -U robt db (e.g . remote shell call, local is same) 3. if you use bash shell, you can also use pgbash(http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html) Nelson wrote: > thank you jie Liang for your response, but my problems are: > 1. How to store a query in the database. > 2. How to give a parameter from outside of database, for example: > select * from table1 where row1 = my_parameter_outside. > Give me an example please. -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 jliang@ipinc.com www.ipinc.com --------------8C7B629968ACD4DCC55D510E Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,
So, your question is not client side,
you want store a procedure in db(server side) can accept para from client side.
I have not seen Pg has a functionality to do like store procedure or package like Oracle
( maybe I don't know), so , I suggest that :
1 use embeded SQL
2. store query as a SQL in shell script( because shell script can accept parameters)
    in shell , you can say:
    echo "select * from table1 where row1=$1"|rsh pg_server /usr/local/pgsql/bin/psql -U robt db
    (e.g . remote shell call, local is same)
3. if you use bash shell, you can also use pgbash(http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html)

Nelson wrote:

thank you jie Liang for your response, but my problems are:
1. How to store a query in the database.
2. How to give a parameter from outside of database, for example:
select * from table1 where row1 = my_parameter_outside.
Give me an example please.
-- 
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com
  --------------8C7B629968ACD4DCC55D510E--