Thread: Run Time Variables

Run Time Variables

From
Phil Hayward
Date:
Can anyone assist please?
In Oracle it is possible to enter variables at run time with a query as follows

SELECT name, salary, dept
FROM emp
WHERE empid = &empid;

On running the query you will be prompted .....

Enter value for empid:

Is there an equivalent feature in PostgreSql, Psql ?


--
Phil Hayward
London, England

phil@springfield.co.nz
phil@springfield.uklinux.net

add primary key

From
"mikhail malamud"
Date:
ALTER TABLE Activity add
    CONSTRAINT  PRIMARY KEY
    (
        ActivityId
    )
What's wrong with this. How do I add primary key constraint.
I tried to look in the docs but I could not find the answer, can anyone
also point me to a place where I could find an answer to this question
without disturbing the entire mailing list with such a probably simple
question.


Re: Run Time Variables

From
"Anthony E . Greene"
Date:
On Sat, 10 Mar 2001 13:37:39 Phil Hayward wrote:
>Can anyone assist please?
>In Oracle it is possible to enter variables at run time with a query as
>follows
>
>SELECT name, salary, dept
>FROM emp
>WHERE empid = &empid;
>
>On running the query you will be prompted .....
>
>Enter value for empid:
>
>Is there an equivalent feature in PostgreSql, Psql ?

In pgaccess you can create a query that looks like this:

  select name, salary, dept
  from emp
  where emp_id = '[parameter "Employee ID?"]'

A dialog box will prompt you for input. I don't know of a way to do this
within psql.

Tony
--
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>

RE: add primary key

From
"mikhail malamud"
Date:
Can someone please tell me the answer to this simple question?

-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org]On Behalf Of mikhail malamud
Sent: Saturday, March 10, 2001 10:55 PM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] add primary key


ALTER TABLE Activity add
    CONSTRAINT  PRIMARY KEY
    (
        ActivityId
    )
What's wrong with this. How do I add primary key constraint.
I tried to look in the docs but I could not find the answer, can anyone
also point me to a place where I could find an answer to this question
without disturbing the entire mailing list with such a probably simple
question.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html


RE: add primary key

From
"mikhail malamud"
Date:
I ve been trying to find an answer to this question but all in vain. Can
someone pleease help me. How do you add a primary key constraint to an
existing table.



-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org]On Behalf Of mikhail malamud
Sent: Saturday, March 10, 2001 10:55 PM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] add primary key


ALTER TABLE Activity add
    CONSTRAINT  PRIMARY KEY
    (
        ActivityId
    )
What's wrong with this. How do I add primary key constraint.
I tried to look in the docs but I could not find the answer, can anyone
also point me to a place where I could find an answer to this question
without disturbing the entire mailing list with such a probably simple
question.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


Re: add primary key

From
"Oliver Elphick"
Date:
"mikhail malamud" wrote:
  >I ve been trying to find an answer to this question but all in vain. Can
  >someone pleease help me. How do you add a primary key constraint to an
  >existing table.
  >
  >
  >
  >-----Original Message-----
  >From: pgsql-novice-owner@postgresql.org
  >[mailto:pgsql-novice-owner@postgresql.org]On Behalf Of mikhail malamud
  >Sent: Saturday, March 10, 2001 10:55 PM
  >To: pgsql-novice@postgresql.org
  >Subject: [NOVICE] add primary key
  >
  >
  >ALTER TABLE Activity add
  >    CONSTRAINT  PRIMARY KEY
  >    (
  >        ActivityId
  >    )
  >What's wrong with this. How do I add primary key constraint.

The facility is not supported, even at 7.1

Dump your database with pg_dump, edit the dump file and reload it.

If the facility were supported, the command would be:

  ALTER TABLE Activity ADD CONSTRAINT Activity PRIMARY KEY(ActivityId)


--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Who is like Thee among the gods, O Lord? Who is like
      Thee, majestic in holiness, awesome in praises,
      working wonders?"
                              Exodus 15:11



Re: add primary key

From
lee johnson
Date:
just wondering if converting msaccess databases ( will forms/reports tables all convert?)

into pgaccess via pgadmin in windows work or is this a nightmare to
setup/do..

thanks
lee