Oracle/PLSQL: Mod Function

本文介绍了 Oracle/PLSQL 中的 MOD 函数,详细解释了其语法、计算方式及与其他函数的区别,并通过多个实例展示了如何使用 MOD 函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In Oracle/PLSQL, the mod function returns the remainder of m divided by n.

Syntax

The syntax for the mod function is:

mod( m, n )

The mod is calculated as:

m - n * floor(m/n)

Note

The mod function uses the floor function in its formula, whereas the remainder function uses the round function in its formula.

The mod function returns m if n is 0.

Applies To

  • Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

For Example

mod(15, 4)

would return 3

mod(15, 0)

would return 15

mod(11.6, 2)

would return 1.6

mod(11.6, 2.1)

would return 1.1

mod(-15, 4)

would return -3

mod(-15, 0)

would return -15

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值