본문 바로가기
카테고리 없음

Oracle -plSQL을 이용한 구구단 출력하기 (loop구문) - 가로로 2~9단까지

by 팁텍북 2017. 12. 8.

Oracle -plSQL을 이용한 구구단 출력하기 (loop구문)





set serveroutput on

declare

    dan number:=1;

    i number:=1;

begin


loop

i:=1;

dan:=dan+1;

    loop

        dbms_output.put(dan||'*'||i||'='||(dan*i)||'  ');

        i:=i+1;

        if i>9 then

        dbms_output.new_line;

            exit;

        end if;

    end loop;

    if dan>=9 then

    exit;

    end if;

end loop;

end;




댓글