Monday, 30 June 2014

pl/sql program to find given number is even or odd.

Procedure:

Declare
     n number(4):=&n;
 Begin
     if mod(n,2)=0
    then
       dbms_output.put_line(n||' even number');
    else
      dbms_output.put_line(n||' odd number');
   end if;
end;
/

Execution:

SQL> @e:\plsql\even.sql
Enter value for n: 5
old   2:  n number(4):=&n;
new   2:  n number(4):=5;

5 odd number

PL/SQL procedure successfully completed.

Conclusion:
       a pl/sql program is successfully executed for finding even or odd.

0 comments:

Post a Comment

Copyright © ORACLE-FORU - SQL, PL/SQL and ORACLE D2K(FORMS AND REPORTS) collections | Powered by Blogger
Design by N.Design Studio | Blogger Theme by NewBloggerThemes.com