函数语法:sign( n)
函数说明:判定值n的符号,若 n > 0,返回是 1;若 n < 0,返回 -1;若 n = 0,则返回0。
函数示例:
一、select sign(100) as "正数100" , sign(-100) as "负数-100" , sign(0) as "零0" from dual;
二、a=10,b=20;
select sign(a-b) from dual; 结果:-1
select sign(b-a) from dual; 结果: 1
时间: 2024-10-18 04:43:34