function RAWTOHEX can converts rawto a character value containing its hexadecimal equivalent.

解决方案 »

  1.   

    function RAWTOHEX can converts raw to a character value containing its hexadecimal equivalent.
      

  2.   

    使用long raw有很多限制,具体参考:
    Application Developer’s Guide - Fundamentals
    下载地址:
    http://gigabase.idi.ntnu.no/oradoc/nav/docindex.htm
      

  3.   

    select * from where rawtohex(longrawfield) ='% keywords%'运行有错误啊
      

  4.   

    clob能存多大,实在不行我要改变字段类型了
      

  5.   

    long field can not include in where statements
      

  6.   

    you should read Application Developer’s Guide - Fundamentals.
    please read it before you ask some questions.
      

  7.   

    jiezhi(西域浪子)兄弟,别卖关子了好不好如果你知道请直接给出代码,兄弟实在是很着急来不及看英文了,在此多谢了!!
      

  8.   

    try:
    select * from 
    (select ...,rawtohex(longrawfield) as longfie from where table_name )
    where instr(longfie,keywords)>0
      

  9.   

    sorry,
    try:
    select * from 
    (select ...,rawtohex(longrawfield) as longfie from table_name where)
    where instr(longfie,keywords)>0
      

  10.   

    不小心漏掉了东西
    select * from 
    (select ...,rawtohex(longrawfield) as longfie from table_name)
    where instr(longfie,keywords)>0
    --------------------------
    where语句里面不可以包含long raw字段。
      

  11.   

    不行啊,兄弟
    select rawtohex(doc_body) as longfie from newsdoc
    :java.sql.SQLException: ORA-00997: 非法使用 LONG 数据类型 
      

  12.   

    不对,rawtohex对其他类型是可以的. 就是对long raw字段不行.非法使用 LONG 数据类型
      

  13.   

    把它转为clob吧,比较好用.
    CREATE TABLE long_table (n NUMBER, long_col LONG);
    CREATE TABLE lob_table (n NUMBER, lob_col CLOB);
    --use this function to convert LONG to LOB values as follows: INSERT INTO lob_table
      SELECT n, TO_LOB(long_col) FROM long_table;
      

  14.   

    sorry,上面发错了贴.
    自已自定义一个函数,然后调用它就可以了。
    create function raw_to_varchar2(p_raw in long raw)
    return varchar2
    as
    begin
    return UTL_RAW.CAST_TO_VARCHAR2(p_raw);
    end;
    /select * from where raw_to_varchar2(longrawfield) like '%keywords%';
      

  15.   

    你真是高手啊,可是定义的函数放在哪里呢? 事先放在orcale的存储过程里面?还是在调用sql的时候用?? 多谢了,成功了的话,再开个帖子给你加分
      

  16.   

    不用,在pl*plus命令执行以上代码后,就创建了函数对象。
    在当前用户任何情况都可以直接调用.
      

  17.   

    不知道为什么还是不行! 
    函数是创建成功了但是SQL> select * from newsdoc where raw_to_varchar2(doc_body) like '%11%';
    ERROR 位于第 1 行:
    ORA-00997: 非法使用 LONG 数据类型
      

  18.   

    当然不行,字段中含有long raw类型.
    select col1_name,col2_name,....,raw_to_varchar2(doc_body) from newsdoc where instr(raw_to_varchar2(doc_body),'11')>1;
      

  19.   

    还是非法使用long 数据类型错误! 
    只要把其他字段类型放到上面的函数里,就没有这样的错误了
    唉,真的没办法了吗