oracle 中如何将字符串转数字? 有现成的函数吗?类似java中的  hashcode 值。
比如:字符串ad-28934-2342-s-23-4  转换后变为56998568234234

解决方案 »

  1.   

    In Oracle 10g you can use the ORA_HASH function which computes a hash value for any given expression. It recieves three arguments: expr - determines the data for which you want Oracle Database to compute a hash value. You can go wild on the length of this string there isn't any restriction on this. max_bucket (optional) - determines the maximum bucket value returned by the hash function. You can specify any value between 0 and 4294967295. The default is 4294967295. seed_value argument (optional) - enables Oracle to produce many different results for the same set of data. Oracle applies the hash function to the combination of expr and seed_value. You can specify any value between 0 and 4294967295. The default is 0. SQL> select ora_hash('ad-28934-2342-s-23-4') from dual;ORA_HASH('AD-28934-2342-S-23-4
    ------------------------------
                        3766956527