sql script for refs_decl