|
From: <ap...@vh...> - 2006-06-14 21:52:40
|
Author: apevec Date: 2006-06-14 23:48:08 +0200 (Wed, 14 Jun 2006) New Revision: 1216 Modified: trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql Log: nvl emulation also for date types Modified: trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql =================================================================== --- trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql 2006-06-14 15:52:52 UTC (rev 1215) +++ trunk/ccm-core/sql/ccm-core/postgres/oracle-compatibility.sql 2006-06-14 21:48:08 UTC (rev 1216) @@ -34,7 +34,47 @@ end; ' language 'plpgsql'; +create or replace function nvl(integer, integer) returns integer as ' +begin + if $1 is null then + return $2; + else + return $1; + end if; +end; +' language 'plpgsql'; +create or replace function nvl(date, date) returns date as ' +begin + if $1 is null then + return $2; + else + return $1; + end if; +end; +' language 'plpgsql'; + +create or replace function nvl(timestamp, timestamp) returns timestamp as ' +begin + if $1 is null then + return $2; + else + return $1; + end if; +end; +' language 'plpgsql'; + +create or replace function nvl(timestamptz, timestamptz) returns timestamptz as ' +begin + if $1 is null then + return $2; + else + return $1; + end if; +end; +' language 'plpgsql'; + + -- Replacements for PG's special operators that cause persistence's -- SQL parser to barf |