Oracle / PLSQL: MOD Function - TechOnTheNet

TechOnTheNet Logo
  1. Home
  2. Oracle / PLSQL
  3. Functions
totn Oracle Functions Oracle / PLSQL: MOD Function

This Oracle tutorial explains how to use the Oracle/PLSQL MOD function with syntax and examples.

Description

The Oracle/PLSQL MOD function returns the remainder of m divided by n.

Syntax

The syntax for the MOD function in Oracle/PLSQL is:

MOD( m, n )

Parameters or Arguments

m Numeric value used in the calculation. n Numeric value used in the calculation.

Calculation

The MOD is calculated as follows:

m - n * floor(m/n)

Returns

The MOD function returns a numeric value. The MOD function returns m if n is 0.

Note

  • The MOD function uses the FLOOR function in its formula.
  • See also the REMAINDER function.

Applies To

The MOD function can be used in the following versions of Oracle/PLSQL:

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

Example

Let's look at some Oracle MOD function examples and explore how to use the MOD function in Oracle/PLSQL.

For example:

MOD(15, 4) Result: 3 MOD(15, 0) Result: 15 MOD(11.6, 2) Result: 1.6 MOD(11.6, 2.1) Result: 1.1 MOD(-15, 4) Result: -3 MOD(-15, 0) Result: -15 Share on:

Databases

  • SQL
  • Oracle / PLSQL
  • SQL Server
  • MySQL
  • MariaDB
  • PostgreSQL
  • SQLite

MS Office

  • Excel
  • Access
  • Word

Web Development

  • HTML
  • CSS
  • JavaScript
  • Color Picker

Programming

  • C Language

More

  • ASCII
  • Unicode
  • Linux
  • UNIX
  • Techie Humor
clear filter right caret

Oracle Basics

  • ALIASES
  • AND
  • AND & OR
  • BETWEEN
  • COMPARISON OPERATORS
  • DELETE
  • DISTINCT
  • EXISTS
  • FROM
  • GROUP BY
  • HAVING
  • IN
  • INSERT
  • INSERT ALL
  • INTERSECT
  • IS NOT NULL
  • IS NULL
  • JOIN
  • LIKE
  • MINUS
  • NOT
  • OR
  • ORDER BY
  • PIVOT
  • REGEXP_LIKE
  • SELECT
  • SUBQUERY
  • TRUNCATE
  • UNION
  • UNION ALL
  • UPDATE
  • WHERE
right caret

Oracle Advanced

  • Alter Table
  • Alter Tablespace
  • Change Password
  • Check Constraints
  • Comments in SQL
  • Create Schema
  • Create Schema Statement
  • Create Table
  • Create Table As
  • Create Tablespace
  • Create User
  • Data Types
  • Declare Variables
  • Drop Table
  • Drop Tablespace
  • Drop User
  • Error Messages
  • Find Default Tablespace
  • Find Users
  • Find Users Logged In
  • Find Version Information
  • Functions
  • Global Temporary
  • Grant/Revoke Privileges
  • Indexes
  • Literals
  • Local Temporary
  • Primary Keys
  • Procedures
  • Roles
  • Sequences
  • Set Default Tablespace
  • Synonyms
  • System Tables
  • Unique Constraints
  • Views
right caret

Oracle Cursors

  • Close Cursor
  • Cursor Attributes
  • Declare Cursor
  • Fetch Cursor
  • Open Cursor
  • Select For Update
  • Where Current Of
right caret

Oracle Exception Handling

  • Named Programmer-Defined Exception
  • Named System Exception
  • WHEN OTHERS Clause
  • SQLCODE
  • SQLERRM
right caret

Oracle Foreign Keys

  • Disable Foreign Key
  • Drop Foreign Key
  • Enable Foreign Key
  • Foreign Key
  • Foreign Key (cascade delete)
  • Foreign Key (set null delete)
right caret

Oracle Loops/Conditionals

  • CURSOR FOR LOOP
  • EXIT
  • FOR LOOP
  • GOTO
  • IF-THEN-ELSE
  • LOOP
  • REPEAT UNTIL LOOP
  • WHILE LOOP
right caret

Oracle Transactions

  • Commit Transaction
  • Lock Table
  • Rollback Transaction
  • Set Transaction
right caret

Oracle Triggers

  • After Delete Trigger
  • After Insert Trigger
  • After Update Trigger
  • Before Delete Trigger
  • Before Insert Trigger
  • Before Update Trigger
  • Disable All Triggers
  • Disable Trigger
  • Drop Trigger
  • Enable All Triggers
  • Enable Trigger
right caret

String/Char Functions

  • ASCII
  • ASCIISTR
  • CHR
  • COMPOSE
  • CONCAT
  • Concat with ||
  • CONVERT
  • DECOMPOSE
  • DUMP
  • INITCAP
  • INSTR
  • INSTR2
  • INSTR4
  • INSTRB
  • INSTRC
  • LENGTH
  • LENGTH2
  • LENGTH4
  • LENGTHB
  • LENGTHC
  • LOWER
  • LPAD
  • LTRIM
  • NCHR
  • REGEXP_INSTR
  • REGEXP_REPLACE
  • REGEXP_SUBSTR
  • REPLACE
  • RPAD
  • RTRIM
  • SOUNDEX
  • SUBSTR
  • TRANSLATE
  • TRIM
  • UPPER
  • VSIZE
down caret

Numeric/Math Functions

  • ABS
  • ACOS
  • ASIN
  • ATAN
  • ATAN2
  • AVG
  • BITAND
  • CEIL
  • COS
  • COSH
  • COUNT
  • EXP
  • FLOOR
  • GREATEST
  • LEAST
  • LN
  • LOG
  • MAX
  • MEDIAN
  • MIN
  • MOD
  • POWER
  • REGEXP_COUNT
  • REMAINDER
  • ROUND (numbers)
  • ROWNUM
  • SIGN
  • SIN
  • SINH
  • SQRT
  • SUM
  • TAN
  • TANH
  • TRUNC (numbers)
right caret

Date/Time Functions

  • ADD_MONTHS
  • CURRENT_DATE
  • CURRENT_TIMESTAMP
  • DBTIMEZONE
  • EXTRACT
  • LAST_DAY
  • LOCALTIMESTAMP
  • MONTHS_BETWEEN
  • NEW_TIME
  • NEXT_DAY
  • ROUND (dates)
  • SESSIONTIMEZONE
  • SYSDATE
  • SYSTIMESTAMP
  • TRUNC (dates)
  • TZ_OFFSET
right caret

Conversion Functions

  • BIN_TO_NUM
  • CAST
  • CHARTOROWID
  • FROM_TZ
  • HEXTORAW
  • NUMTODSINTERVAL
  • NUMTOYMINTERVAL
  • RAWTOHEX
  • TO_CHAR
  • TO_CLOB
  • TO_DATE
  • TO_DSINTERVAL
  • TO_LOB
  • TO_MULTI_BYTE
  • TO_NCLOB
  • TO_NUMBER
  • TO_SINGLE_BYTE
  • TO_TIMESTAMP
  • TO_TIMESTAMP_TZ
  • TO_YMINTERVAL
right caret

Analytic Functions

  • CORR
  • COVAR_POP
  • COVAR_SAMP
  • CUME_DIST
  • DENSE_RANK
  • FIRST_VALUE
  • LAG
  • LAST_VALUE
  • LEAD
  • LISTAGG
  • NTH_VALUE
  • RANK
  • STDDEV
  • VAR_POP
  • VAR_SAMP
  • VARIANCE
right caret

Advanced Functions

  • BFILENAME
  • CARDINALITY
  • CASE
  • COALESCE
  • DECODE
  • EMPTY_BLOB
  • EMPTY_CLOB
  • GROUP_ID
  • LNNVL
  • NANVL
  • NULLIF
  • NVL
  • NVL2
  • SYS_CONTEXT
  • UID
  • USER
  • USERENV

Home | About Us | Contact Us | Testimonials | Donate

While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy.

Copyright © 2003-2025 TechOnTheNet.com. All rights reserved.

Từ khóa » Hàm Mod Trong Sql