Oracle uuid 生成方案

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:120

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

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

[font="]select random_uuid from temp6

[font="]select bb.*, field||trim(to_char(ROWNUM,'0999')) as code from (
[font="]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="]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

本文标签:
本文标题:Oracle uuid 生成方案
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】