From ffd4bae910ad8e64b044b694ac3e2bab948f7bba Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Mon, 17 Sep 2012 10:39:38 +0200
Subject: Work around Oracle 10.2 issue with CREATE OR REPLACE TYPE

---
 oracle/custom/custom.sql | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'oracle')

diff --git a/oracle/custom/custom.sql b/oracle/custom/custom.sql
index 191f397..6e22903 100644
--- a/oracle/custom/custom.sql
+++ b/oracle/custom/custom.sql
@@ -1,7 +1,18 @@
 /* This file contains custom type definitions and helper functions.
  */
 
-CREATE OR REPLACE TYPE Numbers AS VARRAY(100) OF NUMBER(10);
+/* For some reason CREATE OR REPLACE TYPE does not work on Oracle 10.2. */
+BEGIN
+  BEGIN
+    EXECUTE IMMEDIATE 'DROP TYPE Numbers';
+  EXCEPTION
+    WHEN OTHERS THEN
+      IF SQLCODE != -4043 THEN RAISE; END IF;
+  END;
+END;
+/
+
+CREATE TYPE Numbers AS VARRAY(100) OF NUMBER(10);
 /
 
 CREATE OR REPLACE FUNCTION string_to_numbers(in_str IN VARCHAR2) RETURN Numbers
-- 
cgit v1.1