 'Gemscript' as vocabulary_id_2,
 'Maps to' as relationship_id,
 (select latest_update from vocabulary where vocabulary_id = 'Gemscript') as valid_start_date,
-'31-Dec-2099' as valid_end_date,
+to_date ('31122099', 'ddmmyyyy') as valid_end_date,
 null as invalid_reason
 from THIN_GEMSC_DMD_0417  
 ;

null as standard_concept,
GEMSCRIPTCODE as concept_code,
(select latest_update from vocabulary where vocabulary_id = 'Gemscript') as valid_start_date, -- TRUNC(SYSDATE)
'31-Dec-2099' as valid_end_date,
null as invalid_reason
from gemscript_reference where GEMSCRIPTCODE not in (select concept_code from concept_stage)
;

null as standard_concept,
GEMSCRIPT_DRUGCODE as concept_code,
(select latest_update from vocabulary where vocabulary_id = 'Gemscript') as valid_start_date, -- TRUNC(SYSDATE)
to_date ('31122099', 'ddmmyyyy') as valid_end_date,
null as invalid_reason
from THIN_GEMSC_DMD_0417 where GEMSCRIPT_DRUGCODE not in (select concept_code from concept_stage)
;
