开发者

PL/SQL procedure random timestamp

开发者 https://www.devze.com 2023-02-12 04:26 出处:网络
how i can generate a random timestamp and put it into 开发者_运维百科a var? Thanks, TommasoI found this solution

how i can generate a random timestamp and put it into 开发者_运维百科a var?

Thanks,

Tommaso


I found this solution

start_date + dbms_random.value(0,86400*(end_date-start_time)+1)/86400

at

http://www.orafaq.com/forum/t/122604/2/


not real sure why but something along the lines of the following pseudocode:

find a random number in a sufficiently large range, and either add or subtract that to SYSDATE.


we have random number generater in oracle...and this random number can be used to add in sysdate to get random dates..or time stamp.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号