1. 首页 > ITPUX技术网 > 正文

Oracle uuid 生成方案

[font=gotham, helvetica, arial, sans-serif]create or replace and compile
[font=&quot]java source named “RandomUUID”
[font=&quot]as
[font=&quot]public class RandomUUID
[font=&quot]{
[font=&quot] public static String create()
[font=&quot] {
[font=&quot] return java.util.UUID.randomUUID().toString();
[font=&quot] }
[font=&quot]}
[font=&quot]/

[font=&quot]CREATE OR REPLACE FUNCTION RandomUUID
[font=&quot]RETURN VARCHAR2
[font=&quot]AS LANGUAGE JAVA
[font=&quot]NAME ‘RandomUUID.create() return java.lang.String’;
[font=&quot]/

[font=&quot]select random_uuid from temp6

[font=&quot]select bb.*, field||trim(to_char(ROWNUM,’0999′)) as code from (
[font=&quot]select “REPLACE”(randomUUID(), ‘-‘, ”) id, ‘QD1005′ as field,’QS5001’ type,leibie as name,htl,dwrz,tyhl,dept_name as spare1,bumen as spare2 from temp6 ORDER BY spare2 ) bb

[font=&quot]insert into LIST_DEFAULT_VALUE(id,field,type,name,htl,dwrz,tyhl,spare1,spare2,code) select “REPLACE”(randomUUID(), ‘-‘, ”) id, ‘QD1005′ as field,’QS5001’ type,leibie as name,htl,dwrz,tyhl,dept_name as spare1,bumen as spare2 from temp6

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息