           c.valid_start_date,
           c.valid_end_date,
           c.invalid_reason
-from v5dev.concept c
+from devv5.concept c
 join t_concept_class_conversion ccc on ccc.concept_class_id_new = c.concept_class_id
-join v5dev.vocabulary_conversion vc on vc.vocabulary_id_v5 = c.vocabulary_id
-left join v5dev.concept_ancestor p on p.descendant_concept_id = c.concept_id and p.ancestor_concept_id!=p.descendant_concept_id -- get parents
-left join v5dev.concept_ancestor c on c.ancestor_concept_id = c.concept_id and c.ancestor_concept_id!=c.descendant_concept_id -- get children
+join devv5.vocabulary_conversion vc on vc.vocabulary_id_v5 = c.vocabulary_id
+left join devv5.concept_ancestor p on p.descendant_concept_id = c.concept_id and p.ancestor_concept_id!=p.descendant_concept_id -- get parents
+left join devv5.concept_ancestor c on c.ancestor_concept_id = c.concept_id and c.ancestor_concept_id!=c.descendant_concept_id -- get children
 WHERE EXISTS (SELECT 1
-                    FROM v5dev.concept c_int
+                    FROM devv5.concept c_int
                    WHERE     c_int.vocabulary_id = c.vocabulary_id
                          AND standard_concept = 'S')  -- where there is at least one standard concept in the same vocabulary
 OR c.concept_code in ('OMOP generated','No matching concept');

          r.is_hierarchical,
          r.defines_ancestry,
          rc_rev.relationship_id
     FROM v5dev.relationship r,
          v5dev.relationship_conversion rc,
          v5dev.relationship_conversion rc_rev
    WHERE     r.relationship_id = rc.relationship_id_new
          AND r.reverse_relationship_id = rc_rev.relationship_id_new;
COMMIT;


--fill tables

INSERT INTO devv5.relationship_conversion (relationship_id,
                                           relationship_id_new)
   SELECT   ROWNUM
          + (SELECT MAX (relationship_id)
               FROM devv5.relationship_conversion)
             AS rn,
          relationship_id
     FROM ( (SELECT relationship_id FROM devv5.relationship
             UNION ALL
             SELECT reverse_relationship_id FROM devv5.relationship)
           MINUS
           SELECT relationship_id_new FROM devv5.relationship_conversion);
COMMIT;

CREATE TABLE t_concept_class_conversion

AS
   (SELECT concept_class, concept_class_id_new
      FROM devv5.concept_class_conversion
     WHERE concept_class_id_new NOT IN (  SELECT concept_class_id_new
                                            FROM devv5.concept_class_conversion
                                        GROUP BY concept_class_id_new
                                          HAVING COUNT (*) > 1))
   UNION ALL
   (  SELECT concept_class_id_new AS concept_class, concept_class_id_new
        FROM devv5.concept_class_conversion
    GROUP BY concept_class_id_new
      HAVING COUNT (*) > 1)
   UNION ALL
   (SELECT concept_class_id AS concept_class,
           concept_class_id AS concept_class_id_new
      FROM devv5.concept
    MINUS
    SELECT concept_class_id_new, concept_class_id_new
      FROM devv5.concept_class_conversion);
		   
 INSERT INTO RELATIONSHIP (RELATIONSHIP_ID,
                          RELATIONSHIP_NAME,
