Moving assignment logic out of interpreter to make it accessible to other PT function implementations; implemented Fetch on SQL type.