Re: Stored procedure - change columns in a table that is being updated / inserted on?

From: bryan(at)flyingiranch(dot)com
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Stored procedure - change columns in a table that is being updated / inserted on?
Date: 2003-03-08 23:20:55
Message-ID: H00000660001d07f.1047165655.mule.flyingiranch.com@MHS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> This sure seems like the hard way to do it. If you really want
> tbluserhealthcalculated to be separate from the underlying table,
> why don't you make it a view?
>
> CREATE VIEW tbluserhealthcalculated AS
> SELECT *, (userWeight / (userHeight * userHeight)) AS bmi
> FROM tbluserhealthbasic;

Next question: One of the reasons a function is attractive to me in this
situation is that I also have some conditionals to handle. For instance,
Base Metabolic Rate is different whether you are male or female (gender
is a boolean value in my table). Can I use IF/THEN syntax in a view
definition?

Bryan

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Rod Kreisler 2003-03-08 23:32:29 String manipulation in plpgsql
Previous Message Tom Lane 2003-03-08 23:17:50 Re: Stored procedure - change columns in a table that is being updated / inserted on?