Hi I am working on a project where we have to migrate the database from oracle to db2. There is a query which picks up certain percentage of records randomly from a table. Currently this query is written in oracle but now I looking for a replacement for that in db2. The query uses DBMS_UTILITY.GET_HASH_VALUE() function of oracle.
SELECT DBMS_UTILITY.GET_HASH_VALUE (TO_CHAR(dbms_utility.get_time)||NU_EMP_ID
,2,1048576) "RANDOM_ORDER", NU_EMP_ID FROM DQDS_EMP
This query gives a sudo column RANDOM_ORDER the value of this column is always different for each time you run this query. after this query is run we pick up the first N records which is always diffenent for each time the query is run. Does DB2 have a similar hashing function like DBMS_UTILITY.GET_HASH_VALUE() of oracle.
Prasoon
SELECT DBMS_UTILITY.GET_HASH_VALUE (TO_CHAR(dbms_utility.get_time)||NU_EMP_ID
,2,1048576) "RANDOM_ORDER", NU_EMP_ID FROM DQDS_EMP
This query gives a sudo column RANDOM_ORDER the value of this column is always different for each time you run this query. after this query is run we pick up the first N records which is always diffenent for each time the query is run. Does DB2 have a similar hashing function like DBMS_UTILITY.GET_HASH_VALUE() of oracle.
Prasoon