in reply to Errror while execution query

It would be very useful to know what kind of thing that $result is. If as I am guessing it is a DBI statement handle, then you should be able to do print $result->errstr()

/J\