Need a hash function name that can generate unique id for each rows.
Posted in 2005
Topics: General Discussion
Hello all, I need a hash function that can generate a unique id for each function like Sybase hash("sadfs",'md5') or oracle get_dbms_utility.hash("sdfsa",99999999,999999) or Mysql md5("asldkfjs"). I have just start informix database. i am looking many document for the function, but i always failed. If any one know any thing about the function pleace let me inform. Advance thanks, if any one give me any clues about that. Maroon www.jence.com
Hello,
when you missed same functionality write your own function...
Here is an quick example for md5:
create table t_md5sum
(sessionid int,
text char(32));
create procedure proc_md5sum(n char(160)) returning char(32);define var1 integer;
define var2 char(160);
define var3 char(32);
let var1 = dbinfo('sessionid');
-- database name is test1 in this example
let var2 = ("( echo ""insert into t_md5sum values (" || var1 || ",
'`echo " || trim(trailing " " from n) || " | md5sum | awk '{print
$1}'`');"" | dbaccess test1 >/dev/null 2>&1)");
system var2;
let var3 = (select text from t_md5sum where sessionid = var1);
delete from t_md5sum where sessionid = var1;return var3;
end procedure;
execute procedure proc_md5sum("asldkfjs");When you would execute this procedure in an select statement you must
remove the delete statement from the procedure (and even delete or
choose an another identifier mechanism).
Regards,
try_and_err
Maroon schrieb:
> Hello all,
> I need a hash function that can generate a unique id for each
> function like Sybase hash("sadfs",'md5') or oracle
> get_dbms_utility.hash("sdfsa",99999999,999999) or Mysql
> md5("asldkfjs").