I have a table with the following, in part:
contract_start date
contract_term int (term in MONTHS)
I want to calculate the contract end date. I came up with:
CREATE FUNCTION "get_contract_end" (integer) RETURNS date AS 'SELECT
cast(contract_start + cast(cast(contract_term as text) || '' month'' as
interval) as date)
FROM circuit WHERE internal_id = $1;' LANGUAGE 'sql';
Is there a better way?
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749