sql - Oracle hash data across rows -
suppose have oracle table 2 columns: type varchar2 , data varchar2. want know if there efficient way in plsql or straight oracle sql compute hash on data column (ideally sha1, md5 or custom oracle hash functions acceptable). example, mysql implementation of solution might like:
mysql dialect query: select type, sha1(group_concat(data order data separator '')) data_hash my_table group type example output: +------+------------------------------------------+ | type | data_hash | +------+------------------------------------------+ | | dbe343bfc23545c72f11fc7d2433df3263a71d0d | | b | b2baee034a7ed3aa1fa1bd441e141909f1b2f57c | +------+------------------------------------------+
i'd prefer straight query on cursor iteration, , sha1 on other hashes.
you try
select type, sum(ora_hash(data)) my_table group type
oracle have collect doesn't work ora_hash. in 11g can do
select deptno, ora_hash(listagg(ename) within group (order ename)) emp group deptno
Comments
Post a Comment