     RETURN NUMBER
   IS
     is_3d NUMBER(1, 0);
-    BEGIN
-      EXECUTE IMMEDIATE 'SELECT 3 FROM user_sdo_geom_metadata m, TABLE(m.diminfo) dim
-                         WHERE table_name = :1 AND column_name = :2 AND dim.sdo_dimname = ''Z'''
-      INTO is_3d USING t_name, c_name;
-
-      RETURN is_3d;
-
-      EXCEPTION
+  BEGIN
+    SELECT 3 INTO is_3d FROM user_sdo_geom_metadata m, TABLE(m.diminfo) dim
+      WHERE table_name = t_name AND column_name = c_name AND dim.sdo_dimname = 'Z';
+
+    RETURN is_3d;
+
+    EXCEPTION
       WHEN NO_DATA_FOUND THEN
-      RETURN 2;
-    END;
+        RETURN 2;
+  END;
 
   /*****************************************************************
   * change_column_srid

    transform           NUMBER := 0
  )
  IS
      unknown_srs_ex EXCEPTION;
    BEGIN
      IF citydb_srs.check_srid(schema_srid) <> 'SRID ok'
      THEN
        DBMS_OUTPUT.PUT_LINE(
            'Your chosen SRID was not found in the MDSYS.CS_SRS table! Chosen SRID was ' || schema_srid);
      ELSE
        -- update entry in DATABASE_SRS table first
        UPDATE DATABASE_SRS
        SET SRID = schema_srid, GML_SRS_NAME = schema_gml_srs_name;
        COMMIT;

        -- change srid of each spatially enabled table
        FOR rec IN (SELECT
                      table_name                       AS t,
                      column_name                      AS c,
                      get_dim(table_name, column_name) AS dim
                    FROM user_sdo_geom_metadata) LOOP
          change_column_srid(rec.t, rec.c, rec.dim, schema_srid, transform);
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('Schema SRID sucessfully changed to ' || schema_srid);
      END IF;
    END;

END citydb_srs;
/
AS
  FUNCTION transform_or_null(geom MDSYS.SDO_GEOMETRY, srid NUMBER)
    RETURN MDSYS.SDO_GEOMETRY;
  FUNCTION is_coord_ref_sys_3d(schema_srid NUMBER)
    RETURN NUMBER;
  FUNCTION check_srid(srsno INTEGER DEFAULT 0)
    RETURN VARCHAR;
