oracle psql 相關

來源:互聯網
上載者:User

1查看分區大小

SELECT SEGMENT_NAME, PARTITION_NAME, BYTES / 1024 / 1024 USED_MB
  FROM DBA_SEGMENTS
 WHERE SEGMENT_NAME IN ('tableone',
                        'tabletwo')

2 比較兩表資料差異

 (select * from table1)

  minus

 (select * from table2)

3 '123,456,789'需要作為in('123','456','789')來查詢,但是正常的replace後得到的還是一個字串,所以才去下面的多行的辦法,

  不過限於sql長度,反倒不如代碼處理後直接得到'123','456','789'合算

  select replace(regexp_substr('123,456,789','[^,]+',1,level),',',' ') c1
               from dual
               connect by level<=length('123,456,789')-length(replace('123,456,789',',',''))+1

4 oracle 10g trim不起作用

  REGEXP_REPLACE(param, '\s*', '')

5 按照座標計算兩點間距離

    earth_padius:=6378137.0;
  radLat1:=3.141592625*lat1/180.0;
  radLat2:=3.141592625*lat2/180.0;
  a:=radLat1 - radLat2;
  b:=3.141592625*lng1/180.0 - 3.141592625*lng2/180.0; 
  s:=2*Asin(Sqrt(power(sin(a / 2), 2) +cos(radLat1) * cos(radLat2) * power(sin(b / 2), 2)));
  s := s * earth_padius;
  s := Round(s * 10000) / 10000.0;
  return(s);

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.