pl/sql program to generate reverse for given number.
Procedure:
declare
n number(4):=&n;
s number(4):=0;
r number(4);
begin
while n>0
loop
r:=mod(n,10);
s:=(s*10)+r;
n:=trunc(n/10);
end loop;
dbms_output.put_line(‘the reverse number is:’);
dbms_output.put_line(s);
end;
/
Execution:
SQL> @e:\plsql\rev.sql
Enter value for n: 457
old 2: n number(4):=&n;
new 2: n number(4):=457;
the reverse number is:
754
PL/SQL procedure successfully completed.
Conclusion:
a pl/sql program is successfully executed to generate reverse number for given number.
Procedure:
declare
n number(4):=&n;
s number(4):=0;
r number(4);
begin
while n>0
loop
r:=mod(n,10);
s:=(s*10)+r;
n:=trunc(n/10);
end loop;
dbms_output.put_line(‘the reverse number is:’);
dbms_output.put_line(s);
end;
/
Execution:
SQL> @e:\plsql\rev.sql
Enter value for n: 457
old 2: n number(4):=&n;
new 2: n number(4):=457;
the reverse number is:
754
PL/SQL procedure successfully completed.
Conclusion:
a pl/sql program is successfully executed to generate reverse number for given number.
0 comments:
Post a Comment