Re: views with parameters - Mailing list pgsql-novice

From Sean Davis
Subject Re: views with parameters
Date
Msg-id 7F1C4314-42E7-11D9-8962-000D933565E8@mail.nih.gov
Whole thread Raw
In response to Re: views with parameters  ("Thomas Hermann(Software)" <hth@sprintsoft.de>)
Responses Re: views with parameters
Re: views with parameters
List pgsql-novice
On Nov 30, 2004, at 4:31 AM, Thomas Hermann(Software) wrote:

> 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'
>

Why not:

create view au_info_selpub 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;

Then:

select * from au_info_selfpub where pub_name='Algodata Infosystems';

Sean



pgsql-novice by date:

Previous
From: "Thomas Hermann(Software)"
Date:
Subject: Re: views with parameters
Next
From: Tom Lane
Date:
Subject: Re: problematic upgrade