 update temp_dnametest set gdisplay_name=null where gdisplay_name ='xxxxxx';
 update temp_dnametest set gdisplay_name=null where gdisplay_name ='xxxxxx';
 
-update temp_dnametest set gdisplay_name=null where gdisplay_name ='xxxxxx';
+update temp_dnametest set gdisplay_name=null where gdisplay_name ='ERROR: The string v_scientific name is not a valid ColdFusion variable name.';
+
+select scientific_name from temp_dnametest where gdisplay_name='ERROR: The string v_canonical_ name is not a valid ColdFusion variable name.';
+update temp_dnametest set gdisplay_name=null where gdisplay_name ='ERROR: The string v_canonical_ name is not a valid ColdFusion variable name.';
+
+-- I hate you so much, ITIS....
+
+declare
+	hasKingdom number;
+begin
+	for r in (select * from temp_dnametest where gdisplay_name='ERROR: The string v_subsp. is not a valid ColdFusion variable name.') loop
+		select count(*) into hasKingdom from taxon_term where taxon_name_id=r.taxon_name_id and
+			source='Arctos' and term_type='kingdom' and term='Animalia';
+		if hasKingdom=1 then
+			dbms_output.put_line('yup');
+			dbms_output.put_line(r.scientific_name);
+			update taxon_term set term_type='subspecies',term=replace(term,' subsp.') where
+				  taxon_name_id=r.taxon_name_id and
+				source='Arctos' and term_type='subsp.'
+				;
+		end if;
+	end loop;
+end;
+/
+-- next...
+-- Arthropoda (phylum)
+
+declare
+	c number;
+begin
+	for r in (select * from temp_dnametest where gdisplay_name='ERROR: The string v_subsp. is not a valid ColdFusion variable name.') loop
+		select count(*) into c from taxon_term where taxon_name_id=r.taxon_name_id and
+			source='Arctos' and term_type='phylum' and term='Arthropoda';
+		if c=1 then
+			dbms_output.put_line('yup: ' || r.scientific_name);
+			update taxon_term set term_type='subspecies',term=replace(term,' subsp.') where
+				  taxon_name_id=r.taxon_name_id and
+				source='Arctos' and term_type='subsp.'
+				;
+
+		else
+			dbms_output.put_line('nope: ' || r.scientific_name);
+
+		end if;
+	end loop;
+end;
+/
+declare
+	c number;
+begin
+	for r in (select * from temp_dnametest where gdisplay_name='ERROR: The string v_subsp. is not a valid ColdFusion variable name.') loop
+		select count(*) into c from taxon_term where taxon_name_id=r.taxon_name_id and
+			source='Arctos' and term_type='nomenclatural_code' and term='ICZN';
+		if c=1 then
+			dbms_output.put_line('yup: ' || r.scientific_name);
+			update taxon_term set term_type='subspecies',term=replace(term,' subsp.') where
+				  taxon_name_id=r.taxon_name_id and
+				source='Arctos' and term_type='subsp.'
+				;
+
+
+		else
+			dbms_output.put_line('nope: ' || r.scientific_name);
+
+		end if;
+	end loop;
+end;
+/
+
+declare
+	c number;
+begin
+	for r in (select * from temp_dnametest where gdisplay_name='ERROR: The string v_subsp. is not a valid ColdFusion variable name.') loop
+		select count(*) into c from taxon_term where taxon_name_id=r.taxon_name_id and
+			source='Arctos' and term_type='nomenclatural_code' and term='ICNB';
+		if c=1 then
+			dbms_output.put_line('yup: ' || r.scientific_name);
+
+
+
+		else
+			dbms_output.put_line('nope: ' || r.scientific_name);
+
+		end if;
+	end loop;
+end;
+/
 
 
 



select taxon_name_id,count(*) from temp_dnametest having count(*) > 1 group by taxon_name_id;


create index ix_temp_junk on temp_dnametest (taxon_name_id) tablespace uam_idx_1;

update temp_dnametest set gdisplay_name=null where gdisplay_name not like 'ERROR%' and gdisplay_name!=display_name;

------------------------------------------------------------------------------------------------------------------------
ERROR: The string v_subsp. is not a valid ColdFusion variable name.
ERROR: The string v_convar. is not a valid ColdFusion variable name.
ERROR: The string v_canonical name is not a valid ColdFusion variable name.
ERROR: The string v_nothof. is not a valid ColdFusion variable name.
ERROR: The string v_subvar. is not a valid ColdFusion variable name.
ERROR: The string v_prol. is not a valid ColdFusion variable name.
ERROR: The string v_subhybr. is not a valid ColdFusion variable name.
ERROR: The string v_var. is not a valid ColdFusion variable name.
ERROR: The string v_subsubvar. is not a valid ColdFusion variable name.
ERROR: The string v_nothosubsp. is not a valid ColdFusion variable name.
ERROR: The string v_lus. is not a valid ColdFusion variable name.
ERROR: The string v_modif. is not a valid ColdFusion variable name.
ERROR: The string v_nothovar. is not a valid ColdFusion variable name.
ERROR: The string v_monstr. is not a valid ColdFusion variable name.
ERROR: The string v_name string is not a valid ColdFusion variable name.
ERROR: The string v_nm. is not a valid ColdFusion variable name.
ERROR: The string v_agamovar. is not a valid ColdFusion variable name.
