In Oracle, the remainder function is MoD (numer1, number2)

Source: Internet
Author: User

In Oracle, the remainder is obtained using the MOD (numer1, number2) function, and the returned value is the other values. For example:

Output 1 ~ All integer values in 13 that are not multiples of 3.

Declare -- I number; begin for I in 1 .. 13 loop if Mod (I, 3 )! = 0 then dbms_output.put_line ('integer not a multiple of 3: '| + I); end if; end loop; Exception when others then dbms_output.put_line (sqlcode | ': '| sqlerrm); end;

 

The output value is:

An integer that is not a multiple of 3: 1
An integer that is not a multiple of 3: 2
An integer that is not a multiple of 3: 4
An integer that is not a multiple of 3: 5
An integer that is not a multiple of 3: 7
An integer that is not a multiple of 3: 8
An integer that is not a multiple of 3: 10
An integer that is not a multiple of 3: 11
An integer that is not a multiple of 3: 13

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.