Print table of Any given Number

00:37 0 Comments A+ a-

Write a PLSQL block to print table of any given number.

Program:


  declare
  i int:=1;
  x int;
  begin
  x:=&x;
  while i<=10 loop
  dbms_output.put_line(x||' * '||i||'  = '||x*i);
   i:=i+1;
  end loop;
  end;
  /


Output:

Enter value for x: 2
old   5: x:=&x;
new   5: x:=2;
2 * 1  = 2
2 * 2  = 4
2 * 3  = 6
2 * 4  = 8
2 * 5  = 10
2 * 6  = 12
2 * 7  = 14
2 * 8  = 16
2 * 9  = 18

2 * 10  = 20