From: <ap...@vh...> - 2006-04-30 10:34:51
|
Author: apevec Date: 2006-04-30 12:31:53 +0200 (Sun, 30 Apr 2006) New Revision: 1127 Modified: trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql Log: one more useful Oracle compatibility function from: http://archives.postgresql.org/pgsql-general/2003-09/msg00068.php Modified: trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql =================================================================== --- trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql 2006-04-28 19:20:42 UTC (rev 1126) +++ trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql 2006-04-30 10:31:53 UTC (rev 1127) @@ -61,3 +61,8 @@ return ~$1; end; ' language 'plpgsql'; + +create or replace function last_day(date) returns date as 'select +cast(date_trunc(''month'', $1) + ''1 month''::interval as date) - 1' +language sql; + |