refactored sprocs to be re-usable instead of temp table approach

also converted varchar columns into varchar2
eb-8669: updated sproc comment to accurately reflect its behavior
Merge remote-tracking branch 'upstream/master'