GBASE南大通用技术分享:GBase 8s 内置函数

标量函数

数学函数汇总

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_02编辑

GBASE南大通用技术分享:GBase 8s ABS

ABS(NUM)

select abs(-5.6) as num1, abs(5.6) as num2 from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_03

> select abs(-5.6) as num1, abs(5.6) as num2 from dual;


            num1             num2 

5.60000000000000 5.60000000000000

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_04

GBASE南大通用技术分享:GBase 8s CEIL/FLOOR/ ROUND

ceil(num)

floor(num)

round(num)

select ceil(5.6) as f_ceil, floor(5.6)as f_floor, round(5.6) as f_round from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_05

> select ceil(5.6) as f_ceil, floor(5.6)as f_floor, round(5.6) as f_round from dual;


          f_ceil          f_floor          f_round 

               6                5                6

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE南大通用_06

select ceil(5.3) as f_ceil, floor(5.3)as f_floor, round(5.3) as f_round from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_07

> select ceil(5.3) as f_ceil, floor(5.3)as f_floor, round(5.3) as f_round from dual;


          f_ceil          f_floor          f_round 

               6                5                5

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_08


select ceil(-5.6) as f_ceil, floor(-5.6)as f_floor, round(-5.6) as f_round from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_09

> select ceil(-5.6) as f_ceil, floor(-5.6)as f_floor, round(-5.6) as f_round from dual;


          f_ceil          f_floor          f_round 

              -5               -6               -6

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_10


select ceil(-5.3) as f_ceil, floor(-5.3)as f_floor, round(-5.3) as f_round from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_11

> select ceil(-5.3) as f_ceil, floor(-5.3)as f_floor, round(-5.3) as f_round from dual;


          f_ceil          f_floor          f_round 

              -5               -6               -5

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_12

MOD

mod(num1, num2)

select mod(10, 3) as f_mod from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_13

> select mod(10, 3) as f_mod from dual;


      f_mod 

          1

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE南大通用_14

POW/SQRT/ROOT

pow(num1, num2)

sqrt(num)

root(num1, num2)

select pow(2, 3) as f_pow3, sqrt(25) as f_sqrt, root(64, 3) as f_root from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_15

> select pow(2, 3) as f_pow3, sqrt(25) as f_sqrt, root(64, 3) as f_root from dual;


        f_pow3         f_sqrt         f_root 

8.000000000000 5.000000000000 4.000000000000

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE南大通用_16

EXP

exp(num)

> select exp(1) as f_exp from dual;


         f_exp 

2.718281828459

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_17

LN/LOGN/LOG10

ln(num)

logn(num)

log10(num)

select ln(2.718281828459) as f_ln, logn(2.718281828459) as f_logn, log10(1000) as f_log10 from dual;

GBASE南大通用GBase 8s数据库常用函数-标量函数_数据库_18

> select ln(2.718281828459) as f_ln, logn(2.718281828459) as f_logn, log10(1000) as f_log10 from dual;


          f_ln         f_logn        f_log10 

1.000000000000 1.000000000000 3.000000000000

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_19

SIN/COS

sin(num)

cos(num)

select sin(1) as f_sin, cos(1) as f_cos from dual;
> select sin(1) as f_sin, cos(1) as f_cos from dual;


         f_sin          f_cos 

0.841470984808 0.540302305868

1 row(s) retrieved.

>

GBASE南大通用GBase 8s数据库常用函数-标量函数_GBASE_20