当前位置:网站首页>Kingbasees plug-in DBMS of Jincang database_ RANDOM
Kingbasees plug-in DBMS of Jincang database_ RANDOM
2022-06-25 11:07:00 【Thousands of sails pass by the side of the sunken boat_】
Catalog
1. DBMS_RANDOM
1.1. DBMS_RANDOM Introduce
KingbaseES Provides DBMS_RANDOM Random data generation function defined under the system package .DBMS_RANDOM The system package provides a random number or character generator .
You need to create extension dbms_random, When you don't need to drop extension dbms_random that will do .
The following table lists them DBMS_RANDOM System packages and a brief description of them .
surface 1 DBMS_RANDOM Package subroutines and functions
Subroutines / function | describe |
INITIALIZE | Use a seed value to initialize the package |
NORMAL Function | Produce a standard normal distribution function |
RANDOM Function | Generate a random integer |
SEED Procedure | Reset random number seed |
STRING Function | Generate a random string |
TERMINATE Procedure | Provides syntactic compatibility without performing any operations |
VALUE Function | Generates a random number in a specified range |
2. INITIALIZE Procedure
Use a seed value to initialize DBMS_RANDOM package , By default ,DBMS_RANDOM The package is based on the user 、 Time 、 Session to initialize .Initialize This function is obsolete , Although currently supported , However, this initialization method is reserved for historical reasons and compatibility .
Grammar format :
DBMS_RANDOM.INITIALIZE(init INTEGER);
Parameter description :
surface 2 initialize Parameters
Parameters describe init Random number seed value
Return value description :
VOID
Example :
CALL dbms_random.initialize(8);
3. NORMAL Function
Produce a standard normal distribution function , The standard deviation of this normal distribution is 1, The expected value is 0.
Grammar format :
DBMS_RANDOM.NORMAL();
Parameter description :
No arguments
Return value description :DOUBLE
Example :
SELECT dbms_random.normal();
4. RANDOM Function
Generate a random integer , This function is out of date , Although it still supports , But it should not be used , Keep this function for compatibility .
Grammar format :
DBMS_RANDOM.RANDOM();
Parameter description :
No arguments
Return value description :
NTEGER
Example :
CALL dbms_random.random();
5. SEED Procedure
Reset seed , Be similar to initialize function ,initialize Functions have been eliminated . seed Function supports both numeric and character values as seed values , and initialize Only numerical values are supported .
Grammar format :
DBMS_RANDOM.SEED(i INTEGER);
DBMS_RANDOM.SEED(t TEXT);
Parameter description :
surface 3 seed Parameters
Parameters describe i Random number seed value t Random number symbol seed value
Return value description :
surface 4 seed Return value
function type SEED(i INTEGER) VOID SEED(t TEXT) VOID
Example :
CALL dbms_random.seed(8);
CALL dbms_random.seed('test');
6. STRING Function
Get a random string , The first parameter is the format of the string , The second parameter is the length of the string . Maximum length 5000, If the parameter exceeds 5000 Will automatically use 5000 Handle .
Grammar format :
DBMS_RANDOM.STRING(type TEXT,len INTEGER);
Parameter description :
surface 5 string Parameters
surface 6 type The corresponding meaning of the parameter
Parameters describe type The type of string generated len The length of the resulting string
'x','X' | Returns a string of uppercase letters and numbers |
'p','P' | Returns a string of any printable character |
Return value description :
TEXT
Example :
SELECT dbms_random.string('U',5);
SELECT dbms_random.string('P',2);
SELECT dbms_random.string('x',4);
SELECT dbms_random.string('a',2);
SELECT dbms_random.string('l',3);
7. TERMINATE Procedure
The original function is to finish using dbms_random Execute this function when package , But now this function does nothing , Reserved for syntax compatibility .
Grammar format :
DBMS_RANDOM.TERMINATE();
Parameter description :
No arguments
Return value description :
VOID
Example :
CALL dbms_random.terminate();
8. VALUE Function
The first way to use no parameters is to get a value greater than or equal to 0 And less than 1 The random number , Accuracy of 16 Decimal place .
In the second way, you can specify the minimum and maximum values , The range of the return value is greater than or equal to low, Less than high, The accuracy is the same as 16 Decimal place .
Grammar format :
DBMS_RANDOM.VALUE();
DBMS_RANDOM.VALUE(low INTEGER,high INTEGER);
Parameter description :
surface 7 value Parameters
Parameters describe low The minimum value of the generated random number high The maximum value of the generated random number
Return value description :
surface 8 value Return value
function type VALUE() VOID VALUE(low INTEGER,high INTEGER) VOID
Example :
SELECT dbms_random.value();
SELECT dbms_random.value(10,15);
边栏推荐
- 金仓KFS数据集中场景(多对一)部署
- Checking whether the double value is an integer - Swift - checking if a double value is an integer - swift
- TASK03|概率论
- Server rendering
- Android: generic mapping analysis of gson and JSON in kotlin
- Binder explanation of Android interview notes
- GaussDB 如何统计用户sql的响应时间
- 金仓数据库 KingbaseES 插件DBMS_OUTPUT
- 性能之内存篇
- 性能之文件系统篇
猜你喜欢
金仓KFS数据集中场景(多对一)部署
FPGA基于VGA显示字符及图片
How to start the phpstudy server
ZABBIX distributed system monitoring
Kotlin arrays and collections (1) {create arrays, use arrays, use for in loops to traverse arrays, use array indexes, and multi-dimensional arrays}
戴尔科技演绎“快”字诀,玩转CI/CD
XSS attack
Socket communication principle
1-7Vmware中的快照与克隆
[image fusion] image fusion based on morphological analysis and sparse representation with matlab code
随机推荐
Remove the problem of orange border on the desktop control in WebView
Some assembly instructions specific to arm64
持续交付-Jenkinsfile 语法
SystemVerilog(十三)-枚举数据类型
What are the functions of arm64 assembly that need attention?
ES 学习
Google Earth engine (GEE) - evaluate enables one click batch download of all single images in the research area (some areas in Shanghai)
看完这篇 教你玩转渗透测试靶机Vulnhub——DriftingBlues-7
金仓数据库 KingbaseES 插件dbms_session
Network remote access using raspberry pie
Android:kotlin中Gson与JSON的泛型映射解析
Is it safe for Guosen Securities to open a securities account
CDN+COS搭建图床超详细步骤
数据库系列:MySQL索引优化总结(综合版)
Compilation of learning from Wang Shuang (1)
Think about it
软件测试 避免“试用期被辞退“指南,看这一篇就够了
Kotlin arrays and collections (1) {create arrays, use arrays, use for in loops to traverse arrays, use array indexes, and multi-dimensional arrays}
Netease's open source distributed storage system curve officially became the CNCF sandbox project
MySQL and Oracle processing CLOB and blob fields