WITH A AS( SELECT '002' AS A1 FROM DUAL UNION ALL
SELECT '003' AS A1 FROM DUAL UNION ALL
SELECT '006' AS A1 FROM DUAL UNION ALL
SELECT 'P001' AS A1 FROM DUAL UNION ALL
SELECT 'P002' AS A1 FROM DUAL UNION ALL
SELECT 'P003' AS A1 FROM DUAL UNION ALL
SELECT 'P004' AS A1 FROM DUAL UNION ALL
SELECT 'P005' AS A1 FROM DUAL )
SELECT A1 FROM A
이렇게 했을때는
002
003
006
P001
P002
P003
P004
P005
이런식으로 나오는데
002
P002
003
P003
006
P001
P004
P005
이런식으로 P가 붙은것중에 P가 안붙은것과 같은것이 있다면 P가 바로다음으로나오고 P가붙은 나머지들은 맨뒤로 오게 하려고 하는데 좋은 방법을 알려주시면 감사하겠습니다