SQL> declare
2 cn_string constant varchar2(3) := 'HER';
3 begin
4 for i in 1..3
5 loop
6 for j in 1..3
7 loop
8 for k in 1..3
9 loop
10 if i != j
11 and j != k
12 and k != i
13 then
14 dbms_output.put_line
15 ( substr(cn_string,i,1) ||
16 substr(cn_string,j,1) ||
17 substr(cn_string,k,1)
18 );
19 end if;
20 end loop;
21 end loop;
22 end loop;
23 end;
24 /
HER
HRE
EHR
ERH
RHE
REH