Re: views with parameters - Mailing list pgsql-novice

From Thomas Hermann(Software)
Subject Re: views with parameters
Date
Msg-id BLEJJCIDDLINMPGGCKFCOEHKCDAA.hth@sprintsoft.de
Whole thread Raw
In response to Re: views with parameters  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: views with parameters
List pgsql-novice
Bruno, thank you for your patience, but I still don't have a clou.
Let me illustrate this with a sample from MS SQL-Server:

CREATE PROCEDURE au_info_selpub
   @pubname varchar(40)
AS
SELECT au_lname, au_fname, title, pub_name
   FROM authors a INNER JOIN titleauthor ta
      ON a.au_id = ta.au_id INNER JOIN titles t
      ON t.title_id = ta.title_id INNER JOIN publishers p
      ON t.pub_id = p.pub_id
   WHERE  p.pub_name = @pubname

EXEC au_info_selpub 'Algodata Infosystems'

This sample refers to the "pubs" database used in several bokks on MS and
Sysbase.
It returns a recordset with data in 4 columns, including column names and
data types per column.
What would be the PostgreSQL equivalent? And would I get the same results?

Thank you again
Tom Hermann


-----Ursprungliche Nachricht-----
Von: Bruno Wolff III [mailto:bruno@wolff.to]
Gesendet: Montag, 29. November 2004 17:34
An: Thomas Hermann(Software)
Cc: pgsql-novice@postgresql.org
Betreff: Re: [NOVICE] views with parameters


On Sun, Nov 28, 2004 at 00:39:40 +0100,
  "Thomas Hermann(Software)" <hth@sprintsoft.de> wrote:

Usually you want to keep responses coppied to the list so that others
can comment on the thread.

> Thank you very much for your expedient response. I am currently running
the
> 8 beta.
> 1) I want to modify the returned result set by sending different values
used
> in the where clause, hence I get the desired information from the table.
> Assume I have the profile ID of a user an need to know the details of the
> profile, I can feed the profile to the view ID and get the proper details
> back. If the select statement within a view does not change, I can as well
> have select statement stored elsewhere.

You can supply the profile ID in a where clause when you select from the
view. Is there some reason you can't do that?


pgsql-novice by date:

Previous
From: Kaloyan Iliev Iliev
Date:
Subject: Re: automatically lower string and remove unnecessary whitespace
Next
From: Sean Davis
Date:
Subject: Re: views with parameters