agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: gulsumramazanoglu <gulsumramazanoglu@gmail.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: anand086 <anand086@gmail.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: YNT: Re: YNT: Re: Using bind variable within BEGIN END
Date: Fri, 02 Jun 2017 23:19:17 +0300
Message-ID: <t2bcjylen3u0or1325mbd6cc.1496434757258@email.android.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Thank you guys for all replies, before asking more and taking your valuble time i need to read some more.. it would be weird not to be able to do that in such a strong db like PostgreSQL as it is, the reason of question marks is about me, not the db:) .. thanks again..
Samsung cihazımdan gönderildi
-------- Orjinal mesaj --------
Kimden: Adrian Klaver <adrian.klaver@aklaver.com>
Tarih: 2 06 2017 11:00 PM (GMT+02:00)
Alıcı: gulsumramazanoglu <gulsumramazanoglu@gmail.com>, "David G. Johnston" <david.g.johnston@gmail.com>, anand086 <anand086@gmail.com>
Cc: pgsql-sql@postgresql.org
Konu: Re: YNT: Re: [SQL] Using bind variable within BEGIN END
On 06/02/2017 11:38 AM, gulsumramazanoglu wrote:
> ... which will pass arguments and get back a result set, i mean..
Using Python and psycopg2:
\df billing_days
List of functions
Schema | Name | Result data type | Argument data
types | Type
--------+--------------+--------------------------+--------------------------------+--------
public | billing_days | TABLE(billing_date date) | start_date date,
end_date date | normal
select * from billing_days('05/01/2017', '05/30/2017');
billing_date
--------------
2017-05-01
2017-05-02
2017-05-03
2017-05-04
2017-05-05
2017-05-08
2017-05-09
2017-05-10
2017-05-11
2017-05-12
2017-05-15
2017-05-16
2017-05-17
2017-05-18
2017-05-19
2017-05-22
2017-05-23
2017-05-24
2017-05-25
2017-05-26
2017-05-29
2017-05-30
import psycopg2
con = psycopg2.connect('dbname=**** user=***_admin host=localhost')
bill_cur = con.cursor()
bill_cur.execute("SELECT * FROM billing_days(%s, %s)" , ('05/01/2017',
'05/31/2017'))
bill_rs = bill_cur.fetchall()
for row in bill_rs:
print(row[0])
2017-05-01
2017-05-02
2017-05-03
2017-05-04
2017-05-05
2017-05-08
2017-05-09
2017-05-10
2017-05-11
2017-05-12
2017-05-15
2017-05-16
2017-05-17
2017-05-18
2017-05-19
2017-05-22
2017-05-23
2017-05-24
2017-05-25
2017-05-26
2017-05-29
2017-05-30
2017-05-31
>
>
>
> Samsung cihazımdan gönderildi
--
Adrian Klaver
adrian.klaver@aklaver.com
Message-ID: <t2bcjylen3u0or1325mbd6cc.1496434757258@email.android.com>
Permalink: ../t2bcjylen3u0or1325mbd6cc.1496434757258@email.android.com/
Also on: postgresql.org/message-id/t2bcjylen3u0or1325mbd6cc.1496434757258@email.android.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gulsumramazanoglu@gmail.com, adrian.klaver@aklaver.com, david.g.johnston@gmail.com, anand086@gmail.com
Subject: Re: YNT: Re: YNT: Re: Using bind variable within BEGIN END
In-Reply-To: <t2bcjylen3u0or1325mbd6cc.1496434757258@email.android.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox