DBI is OK has some sample code you might enjoy.
In reply to Re^2: variable type by chromatic in thread variable type by Losing