From: | James Thompson <jamest(at)math(dot)ksu(dot)edu> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | misc psql questions |
Date: | 2001-02-15 17:58:37 |
Message-ID: | Pine.LNX.4.21.0102151129070.4374-100000@hobbes |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
About a lifetime ago I used to do quite a bit of work w/ Oracle.
It's command line sql tool had some pretty nice features that I haven't
been able to find in psql. I was wondering if any of the following
existed....
I think the first was called break on which altered in output from
something like
name date qty
-------------------------
Fred 01-JAN-2000 10
Fred 10-JAN-2000 13
Fred 01-JUL-2000 1
Fred 01-DEC-2000 100
Bob 01-JAN-2000 5
Bob 10-MAY-2000 10
to
name date qty
-------------------------
Fred 01-JAN-2000 10
10-JAN-2000 13
01-JUL-2000 1
01-DEC-2000 100
Bob 01-JAN-2000 5
10-MAY-2000 10
it also allowed for things like compute sum which would activate on breaks
but I don't recall how they worked.
The other thing I'd love to be able to do is get user input while running
a sql file. I don't recall how this worked exactly but the script would
either accept variables calling the script or prompt for them.
So if I had a sql script in a file named contact_report. And I did
prod=> \i contact_report 01-JAN-2000 31-DEC-2001
then it would load the script and replace IIRC &1 and &2 with the
respective dates listed on command line.
It also had an ACCEPT command that would cause it to prompt for input from
user and assign to a varable name. like
accept amount prompt 'Enter the amount to search for: '
select * from foo where quantity = &amount
These made it very easy to build simple reports and scripts for less
technical end users.
Is any of this possible with psql?
Thanks,
James
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson 138 Cardwell Hall Manhattan, Ks 66506 785-532-0561
Kansas State University Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
From | Date | Subject | |
---|---|---|---|
Next Message | Angelo DiSanto | 2001-02-15 18:16:50 | Question |
Previous Message | Hunter Hillegas | 2001-02-15 17:56:14 | Current Year |