Decode360's Blog

          業(yè)精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
            302 隨筆 :: 26 文章 :: 82 評(píng)論 :: 0 Trackbacks
          http://www.itpub.net/viewthread.php?tid=981654&extra=&page=1
          ?
          大牛寫(xiě)的這兩段SQL實(shí)在是太銷(xiāo)魂了,實(shí)在是忍不住要轉(zhuǎn)載過(guò)來(lái),留著以后慢慢看,太牛了……
          ?
          ?
          with a as (select distinct round(a.x + b.x) x,round(a.y + b.y) y from
          (select (sum(x) over(order by n)) x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ? round(sum(y) over(order by n)) y
          ? ?? ?? ?? ???from (select n, cos(n/30 * 3.1415926)*2??x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?sin(n/30 * 3.1415926) y
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?from (select rownum - 1 n from all_objects where rownum <= 30 +30))) a,
          ? ?? ?? ?? ?(select n, (sum(x) over(order by n)) x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ? round(sum(y) over(order by n)) y
          ? ?? ?? ?? ???from (select n,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?cos( m /3 * 3.1415926) * 2 * 15 x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?sin( m /3 * 3.1415926)* 15 y
          ? ?? ?? ?? ?? ?? ?? ? from (select case when rownum <= 2 then 3
          ? ?? ?? ?? ?? ?? ?? ? when rownum = 3 then -2 else -6 end m, rownum - 1 n
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?from all_objects where rownum <= 5))) b
          ? ?? ?? ? )
          select replace(sys_connect_by_path(point, '/'), '/', null) star
          ??from (select b.y, b.x, decode(a.x, null, ' ', '*') point
          ? ?? ?? ? from a,
          ? ?? ?? ?? ?? ?(select *
          ? ?? ?? ?? ?? ?? ?from (select rownum - 1 + (select min(x) from a) x
          ? ?? ?? ?? ?? ?? ?? ?? ???from all_objects
          ? ?? ?? ?? ?? ?? ?? ?? ? where rownum <= (select max(x) - min(x) + 1 from a)),
          ? ?? ?? ?? ?? ?? ?? ???(select rownum - 1 + (select min(y) from a) y
          ? ?? ?? ?? ?? ?? ?? ?? ???from all_objects
          ? ?? ?? ?? ?? ?? ?? ?? ? where rownum <= (select max(y) - min(y) + 1 from a))) b
          ? ?? ?? ?where a.x(+) = b.x
          ? ?? ?? ???and a.y(+) = b.y)
          where x = (select max(x) from a)
          start with x = (select min(x) from a)
          connect by y = prior y
          ? ?? ? and x = prior x + 1;
          ?
          ?

          ????????????? * * * * * *?????????????????? * * * * * *?????????????????? * * * * * *?????????????
          ????????? * *???????????? * *?????????? * *???????????? * *?????????? * *???????????? * *?????????
          ?????? * *?????????????????? * *???? * *?????????????????? * *???? * *?????????????????? * *??????
          ???? *?????????????????????????? * *?????????????????????????? * *?????????????????????????? *????
          ?? **??????????????????????????? ***?????????????????????????? ***??????????????????????????? **??
          ? *???????????????????????????? *?? *???????????????????????? *?? *???????????????????????????? *?
          ?*???????????????????????????? *???? *?????????????????????? *???? *???????????????????????????? *
          ?*???????????????????????????? *???? *?????????????????????? *???? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          ?*???????????????????????????? *???? *?????????????????????? *???? *???????????????????????????? *
          ?*?????????????????????????? * * * * * *?????????????????? * * * * * *?????????????????????????? *
          ? *????????????????????? * *??? *?? *??? * *?????????? * *??? *?? *??? * *????????????????????? *?
          ?? *????????????????? * *??????? * *??????? * *???? * *??????? * *??????? * *????????????????? *??
          ??? **????????????? *??????????? ***??????????? * *??????????? ***??????????? *????????????? **???
          ?????? *????????? **?????????? *???? *????????? ***????????? *???? *?????????? **????????? *??????
          ???????? ** *??? *??????? * **???????? ** *??? *?? *??? * **???????? ** *??????? *??? * **????????
          ????????????? * * * * * *?????????????????? * * * * * *?????????????????? * * * * * *?????????????
          ??????????????? *???????????????????????????? *???? *???????????????????????????? *???????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ??????????????? *???????????????????????????? *???? *???????????????????????????? *???????????????
          ??????????????? *???????????????????????????? *???? *???????????????????????????? *???????????????
          ???????????????? *???????????????????????????? *?? *???????????????????????????? *????????????????
          ????????????????? *???????????????????????????? * *???????????????????????????? *?????????????????
          ?????????????????? **?????????????????????????? ***?????????????????????????? **??????????????????
          ????????????????????? *?????????????????????? *???? *?????????????????????? *?????????????????????
          ??????????????????????? ** *???????????? * **???????? ** *???????????? * **???????????????????????
          ???????????????????????????? * * * * * *?????????????????? * * * * * *????????????????????????????
          ?
          with a as (
          ??????????? select distinct round(sum(x) over(order by n)) x,
          ??????????????????????????? round(sum(y) over(order by n)) y
          ????????????? from (select n,
          ?????????????????????????? cos(trunc(n / 20) * (1-1/5) * 3.1415926) * 2 x,
          ?????????????????????????? sin(trunc(n / 20) * (1-1/5) * 3.1415926) y
          ????????????????????? from (select rownum - 1 n from all_objects where rownum <= 20 * 5))
          ????????? )
          select replace(sys_connect_by_path(point, '/'), '/', null) star
          ? from (select b.y, b.x, decode(a.x, null, ' ', '*') point
          ????????? from a,
          ?????????????? (select *
          ????????????????? from (select rownum - 1 + (select min(x) from a) x
          ????????????????????????? from all_objects
          ???????????????????????? where rownum <= (select max(x) - min(x) + 1 from a)),
          ?????????????????????? (select rownum - 1 + (select min(y) from a) y
          ????????????????????????? from all_objects
          ???????????????????????? where rownum <= (select max(y) - min(y) + 1 from a))) b
          ???????? where a.x(+) = b.x
          ?????????? and a.y(+) = b.y)
          where x = (select max(x) from a)
          start with x = (select min(x) from a)
          connect by y = prior y
          ?????? and x = prior x + 1;



          ??????????????????? *???????????????????
          ?????????????????? * *??????????????????
          ?????????????????? * *??????????????????
          ????????????????? *?? *?????????????????
          ???????????????? **?? **????????????????
          ??????????????? *?????? *???????????????
          ??????????????? *?????? *???????????????
          * * * * * * * *** * * * *** * * * * * * *
          ? **????????? *?????????? *????????? **?
          ???? **?????? *?????????? *?????? **????
          ??????? *??? *???????????? *??? *???????
          ????????? ** *???????????? * **?????????
          ??????????? ** *???????? * **???????????
          ?????????? *??? * *?? * *??? *??????????
          ?????????? *?????? * *?????? *??????????
          ????????? *????? * * * *????? *?????????
          ???????? *??? * *?????? * *??? *????????
          ???????? *? *?????????????? *? *????????
          ??????? ** *???????????????? * **???????
          ??????? *?????????????????????? *???????
          ?
          ?
          ?
          ?
          ?



          -The End-

          posted on 2008-11-01 19:47 decode360-3 閱讀(278) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): SQL Dev
          主站蜘蛛池模板: 夏津县| 姚安县| 方正县| 周至县| 牟定县| 大关县| 呼玛县| 台中县| 浦东新区| 兴宁市| 云南省| 崇州市| 江油市| 海阳市| 高唐县| 运城市| 娱乐| 洛川县| 耒阳市| 休宁县| 安平县| 龙胜| 即墨市| 佛教| 永泰县| 阜康市| 兴化市| 荔波县| 时尚| 集贤县| 化州市| 宽城| 宜丰县| 自治县| 江城| 乌鲁木齐县| 双桥区| 西吉县| 白城市| 黄骅市| 故城县|