Suppose I have an oracle table with two columns: type varchar2 and data varchar2. I want to know if there is a somewhat efficient way in plsql or straight oracle sql to compute a hash over all the data column (ideally sha1, but md5 or custom oracle hash functions are acceptable). For example, a mysql implementation of the solution might look like:
mysql dialect query:
select type, sha1(group_concat(data order by data separator '')) data_hash from my_table group by type
example output:
+------+------------------------------------------+
| type | data_hash |
+------+------------------------------------------+
| a | dbe343bfc23545c72f11fc7d2433df3263a71d0d |
| b | b2baee034a7ed3aa1fa1bd441e141909f1b2f57c |
+------+------------------------------------------+
I'd prefer a straight query over a cursor iteration, and sha1 over other hashes.