NEWID 时间
CREATE OR REPLACE FUNCTION newid RETURN varchar2 IS
O_ID NUMBER(30);
V_RANDOM VARCHAR(10);
V_TIME VARCHAR(25);
BEGIN
--取出2位随机数字
SELECT TRUNC(DBMS_RANDOM.VALUE(0, 100)) INTO V_RANDOM FROM DUAL;
--不够2位补齐
IF LENGTH(V_RANDOM) = 1 THEN
V_RANDOM := V_RANDOM || '0';
END IF;
--取出当前日期
SELECT TO_CHAR(current_timestamp, 'YYYYMMDDHHMISSff6') INTO V_TIME FROM DUAL;
--生成id
O_ID := V_TIME || V_RANDOM;
RETURN O_ID;
END;