Maybe I am misunderstanding this, but are you trying to prepare more than one SQL statement in one go? You have to split it up and get rid of any delimiters (statement-terminating semicolons?) that might be in some way special to Xquery as opposed to obeying the pure SQL syntax.