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

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

by 팁텍북 2017. 12. 8.

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


2단, 9단

2단

set serveroutput on

declare

    dan number:=2;

    i number:=1;

begin

loop dbms_output.put_line(

    dan||'*'||i||'='||(dan*i));

    i:=i+1;

    if i>9 then

        exit;

    end if;

    end loop;

end;




 9단

set serveroutput on

declare

    dan number:=9;

    i number:=1;

begin

loop dbms_output.put_line(

    dan||'*'||i||'='||(dan*i));

    i:=i+1;

    if i>9 then

        exit;

    end if;

    end loop;

end;

댓글