Cái này hoạt động:
DECLARE
aLine VARCHAR2(100);
BEGIN
FOR PyramidLevel IN 0..25 LOOP
aLine := NULL;
FOR i IN 0..PyramidLevel-1 LOOP
aLine := aLine || CHR(i+65);
END LOOP;
FOR i IN REVERSE 0..PyramidLevel LOOP
aLine := aLine || CHR(i+65);
END LOOP;
aLine := LPAD(aLine, 26+PyramidLevel);
DBMS_OUTPUT.PUT_LINE('_'||aLine);
END LOOP;
END;
_ A
_ ABA
_ ABCBA
_ ABCDCBA
_ ABCDEDCBA
_ ABCDEFEDCBA
_ ABCDEFGFEDCBA
_ ABCDEFGHGFEDCBA
_ ABCDEFGHIHGFEDCBA
_ ABCDEFGHIJIHGFEDCBA
_ ABCDEFGHIJKJIHGFEDCBA
_ ABCDEFGHIJKLKJIHGFEDCBA
_ ABCDEFGHIJKLMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
_ ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
_ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA
Có vẻ như DBMS_OUTPUT.PUT_LINE()
cắt bớt các ký tự khoảng trắng ở đầu (ít nhất là trong TOAD của tôi), vì vậy tôi đặt _
ở phần đầu.