#1 Multiplication table
/*
Typer: youoracle.blogspot.com
Date: 30.07.2010
Note: maximum dimension is 1000 for normal output
*/
CREATE OR replace PROCEDURE zeynal."Proceduremultiplicationtable" (
dimension IN NUMBER DEFAULT 1)
IS
iterrow NUMBER;
itercolumn NUMBER;
result VARCHAR2 (100);
BEGIN
FOR iterrow IN 1 .. dimension LOOP
FOR itercolumn IN 1 .. dimension LOOP
result := Cast (iterrow * itercolumn AS VARCHAR2);
dbms_output.Put (Rpad (result, 15 - Length (result) - 1));
END LOOP;
dbms_output.Put_line ('');
END LOOP;
END;
/
/*
Typer: youoracle.blogspot.com
Date: 30.07.2010
Note: maximum dimension is 1000 for normal output
*/
CREATE OR replace PROCEDURE zeynal."Proceduremultiplicationtable" (
dimension IN NUMBER DEFAULT 1)
IS
iterrow NUMBER;
itercolumn NUMBER;
result VARCHAR2 (100);
BEGIN
FOR iterrow IN 1 .. dimension LOOP
FOR itercolumn IN 1 .. dimension LOOP
result := Cast (iterrow * itercolumn AS VARCHAR2);
dbms_output.Put (Rpad (result, 15 - Length (result) - 1));
END LOOP;
dbms_output.Put_line ('');
END LOOP;
END;
/
Runing procedure:
DECLARE
dimension NUMBER;
BEGIN
dimension := 10;
zeynal."Proceduremultiplicationtable" (dimension);
COMMIT;
END;
dimension NUMBER;
BEGIN
dimension := 10;
zeynal."Proceduremultiplicationtable" (dimension);
COMMIT;
END;
Output:
1 2 3
2 4 6
3 6 9