mysql数据库随机整数
CEILING() | 向上取整 |
FLOOR() | 向下取整 |
RAND() | 随机生成 0~1 之间的小数(0<1) |
SELECT FLOOR(RAND() * 11)
随机0-11整数
oracle数据库随机数整数
Select round(dbms_random.value(1, 11), 0) as 随机数一,
trunc(dbms_Random.Value(1, 11)) as 随机数二
From dual
1-11
select case mod(abs(dbms_random.random),10)
when 1 then '6709'
when 2 then '6710'
when 3 then '6683'
when 4 then '6702'
when 5 then '6685'
when 6 then '258431'
when 7 then '6714'
when 8 then '6696'
when 9 then '6686'
when 10 then '6701'
when 0 then '6690'
ELSE '6709' END "LOC"
from dual;
update M_M***RE_T set MA***IALID = (
select case mod(abs(dbms_random.random),10)
when 1 then '6709'
when 2 then '6710'
when 3 then '6683'
when 4 then '6702'
when 5 then '6685'
when 6 then '258431'
when 7 then '6714'
when 8 then '6696'
when 9 then '6686'
when 10 then '6701'
when 0 then '6690'
ELSE '6709' END "LOC"
from dual;
) where (MA***LID = '199532' or MATERIALID = '199520') AND CREATEDATE >= to_date('2022-01-01 00:00:00', 'yyyy-MM-dd hh24:mi:ss') AND CREATEDATE <= to_date('2022-10-31 23:59:59', 'yyyy-MM-dd hh24:mi:ss');