Oracle Psql Problems

Source: Internet
Author: User
Tags psql

1. View partition size

Select segment_name, partition_name, Bytes/1024/1024 used_mb
From dba_segments
Where segment_name in ('tableone ',
'Tabletwo ')

2. Compare the data differences between the two tables

(Select * From Table1)

Minus

(Select * From table2)

3 '123' needs to be queried as in ('123', '123', '123'), but after a normal replace, a string is obtained, therefore, the following multi-line approach is adopted,

However, the SQL length is not as good as the SQL length.CodeAfter processing, you can get '123', '123', and '123' cost-effective.

Select Replace (regexp_substr ('20140901', '[^,] +', 1, level), ',', '') C1
From dual
Connect by level <= length ('20140901')-length (replace ('20160901', ',', '') + 1

4 Oracle 10g trim does not work

Regexp_replace (Param, '\ s *','')

5. Calculate the distance between two points based on coordinates

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 );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.