select to_char(S) || to_char(E) || to_char(N) || to_char(D) || '+'
|| to_char(M) || to_char(O) || to_char(R) || to_char(E) || '='
|| to_char(M) || to_char(O) || to_char(N) || to_char(E) || to_char(Y) as 計算式
from (select RowNum-1 as S from all_catalog where RowNum <=10),
(select RowNum-1 as E from all_catalog where RowNum <=10),
(select RowNum-1 as N from all_catalog where RowNum <=10),
(select RowNum-1 as D from all_catalog where RowNum <=10),
(select RowNum-1 as M from all_catalog where RowNum <=10),
(select RowNum-1 as O from all_catalog where RowNum <=10),
(select RowNum-1 as R from all_catalog where RowNum <=10),
(select RowNum-1 as Y from all_catalog where RowNum <=10)
where 1000*(S+M)+100*(E+O)+10*(N+R)+D+E
=10000*M+1000*O+100*N+10*E+Y
and S not in(E,N,D,M,O,R,Y)
and E not in( N,D,M,O,R,Y)
and N not in( D,M,O,R,Y)
and D not in( M,O,R,Y)
and M not in( O,R,Y)
and O not in( R,Y)
and R != Y
and 0 not in(S,M);