title: How to convert long data to char in oracle || ORA-00932: inconsistent datatypes: expected CHAR got LONG
body: <p>I am trying to execute below query which fetches different data on the basis of few criteria. Here i have used like operator on cookies fields and my cookies field is of long datatype. </p>
  
  <pre><code>select * from (
                 select to_char(audit_logs.REQUEST_TIME, 'dd/mm/yyyy HH24:mm:ss') as event_time,
                      audit_logs.CLIENT_REQUEST as client_request,
                      audit_logs.RESPONSE_CODE as responsecode,
                      audit_logs.SIZEOFOBJECT as sizeofobject,
                      audit_logs.COOKIES as cookies,
                      audit_logs.ENV as env,
                      audit_logs.USERID as user_id,
                      audit_logs.POST_DATA as post_data,
                      audit_logs.AUTHSCHEME as authscheme,
                      audit_logs.AUTHMARKET as authmarket,
                      audit_logs.X_REQUESTED_WITH as x_requested_with,
                      audit_logs.METHOD_TYPE as method_type,
                      audit_logs.HOSTNAME as hostname,
                      audit_logs.SESSION_COOKIES as session_cookies,
                      audit_logs.X_FORWARDED_FOR as x_forwarded_for,
                      audit_logs.USER_AGENT as user_agent,
                      audit_logs.GEOIP_COUNTRY_CODE as country_code
                 from audit_logs
                 where
                      REQUEST_TIME &gt;= to_date(:fromdate,'dd/mm/yyyy')
                      and REQUEST_TIME &lt;= to_date(:todate,'dd/mm/yyyy HH24:MI:SS')
                      and COOKIES LIKE '%TANID=%'
                 order by REQUEST_TIME DESC)
  where ROWNUM &lt;= :recordslimit
  order by event_time DESC;
  </code></pre>
  
  <p>While executing above query i am getting below error:</p>
  
  <pre><code>ORA-00932: inconsistent datatypes: expected CHAR got LONG
  00932. 00000 -  "inconsistent datatypes: expected %s got %s"
  </code></pre>
  
  <p>Can someone please how to resolve that.</p>
  
  <p>Note: Changing the datatype will be a time taking job, since my database is having lots of data.</p>