Messy Casts, Is there a better way?
| От | Larry Rosenman | 
|---|---|
| Тема | Messy Casts, Is there a better way? | 
| Дата | |
| Msg-id | 1034676979.436.1.camel@lerlaptop.lerctr.org обсуждение исходный текст  | 
		
| Ответы | 
                	
            		Re: Messy Casts, Is there a better way?
            		
            		 Re: Messy Casts, Is there a better way?  | 
		
| Список | pgsql-sql | 
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
В списке pgsql-sql по дате отправления: