bug 1010: used trinary operator for variable declaration, changed white space /tabs, typo and added orginfo.O to order in SQL statement