right now I can think of writing a function which convert long to varchar2 then in your where clause use this function