Skip site navigation (1) Skip section navigation (2)

Re: views with parameters

From: "Thomas Hermann(Software)" <hth(at)sprintsoft(dot)de>
To: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
Cc: "Bruno Wolff III" <bruno(at)wolff(dot)to>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: views with parameters
Date: 2004-11-30 17:55:32
Message-ID: BLEJJCIDDLINMPGGCKFCAEHMCDAA.hth@sprintsoft.de (view raw or flat)
Thread:
Lists: pgsql-novice
Sean, I see the point.
Thank you
Tom Hermann

-----Ursprungliche Nachricht-----
Von: Sean Davis [mailto:sdavis2(at)mail(dot)nih(dot)gov]
Gesendet: Dienstag, 30. November 2004 16:50
An: Thomas Hermann(Software)
Cc: Bruno Wolff III; pgsql-novice(at)postgresql(dot)org
Betreff: Re: [NOVICE] views with parameters



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



In response to

pgsql-novice by date

Next:From: Ryan RiehleDate: 2004-11-30 18:56:36
Subject: ARE JOINS ALLOWED IN UPDATE STATEMENTS?
Previous:From: Tom LaneDate: 2004-11-30 17:44:57
Subject: Re: sequence newbie question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group