suchen
HeimDatenbankMySQL-TutorialArcSDE10.2.1使用Oracle12c新特性分页

在Oracle 12c推出之后,其中一个新特性就是分页语句。 Easy Top-N and pagination queries ,更易用的Top-N和页码查 询提供了类似MySQL中limit的语法,Row Limiting Clause 注意:该功能是Oracle12c的新特性,并不是ArcGIS的新特性。 语法介绍 row_limiting_


ArcSDE10.2.1使用Oracle12c新特性分页

在Oracle 12c推出之后,其中一个新特性就是分页语句。

Easy Top-N and pagination queries ,更易用的Top-N和页码查

询提供了类似MySQL中limit的语法,Row Limiting Clause

 注意:该功能是Oracle12c的新特性,并不是ArcGIS的新特性。

ArcSDE10.2.1使用Oracle12c新特性分页

语法介绍

<span>row_limiting_clause</span>

The <span>row_limiting_clause</span> allows you to limit the rows returned by the query. You can specify an offset, and number of rows or percentage of rows to return. You can use this clause to implement top-N reporting. For consistent results, specify the <span>order_by_clause</span> to ensure a deterministic sort order.


OFFSET

Use this clause to specify the number of rows to skip before row limiting begins. <span>offset</span> must be a number. If you specify a negative number, then <span>offset</span> is treated as 0. If you specify NULL, or a number greater than or equal to the number of rows returned by the query, then 0 rows are returned. If <span>offset</span> includes a fraction, then the fractional portion is truncated. If you do not specify this clause, then <span>offset</span>is 0 and row limiting begins with the first row.


ROW | ROWS These keywords can be used interchangeably and are provided for semantic clarity.


FETCH

Use this clause to specify the number of rows or percentage of rows to return. If you do not specify this clause, then all rows are returned, beginning at row <span>offset</span> + 1.

FIRST | NEXT These keywords can be used interchangeably and are provided for semantic clarity.


<span>rowcount</span> | <span>percent</span> PERCENT Use <span>rowcount</span> to specify the number of rows to return. <span>rowcount</span> must be a number. If you specify a negative number, then <span>rowcount</span> is treated as 0. If <span>rowcount</span> is greater than the number of rows available beginning at row <span>offset</span> + 1, then all available rows are returned. If <span>rowcount</span> includes a fraction, then the fractional portion is truncated. If <span>rowcount</span> is NULL, then 0 rows are returned.


Use <span>percent</span> PERCENT to specify the percentage of the total number of selected rows to return. <span>percent</span> must be a number. If you specify a negative number, then <span>percent</span> is treated as 0. If <span>percent</span> is NULL, then 0 rows are returned.

If you do not specify <span>rowcount</span> or <span>percent</span> PERCENT, then 1 row is returned.


ROW | ROWS These keywords can be used interchangeably and are provided for semantic clarity.


ONLY | WITH TIES Specify ONLY to return exactly the specified number of rows or percentage of rows.

Specify WITH TIES to return additional rows with the same sort key as the last row fetched. If you specify WITH TIES, then you must specify the<span>order_by_clause</span>. If you do not specify the <span>order_by_clause</span>, then no additional rows will be returned.


当然,大家最喜欢看的就是实际的例子,总结上面就是,在Oracle12c

环境下,提供了更加方便的分页语句,而不再使用Rownum对象了。


测试环境:

ArcSDE10.2.1、Oracle12.1.0.1

sde@PDBORCL> select count(*) from point;

  COUNT(*)
----------
    231774

sde@PDBORCL> select count(*) from poly;

  COUNT(*)
----------
        13

----------------------------------------------------------------------------------


Blog:               http://blog.csdn.net/linghe301

----------------------------------------------------------------------------------


1:获得前N条记录的语句

语法: fetch first N rows only;

sde@PDBORCL> set autotrace on
sde@PDBORCL> select a.objectid,a.poi_name from poly b,point a where sde.st_within(a.shape,b.shape)=1 order by a.objectid fetch first 10 rows only;

  OBJECTID POI_NAME
---------- ----------------------------------------------------------------------
      1326 96699994
      1790 96700095
      6511 96700093
      8761 96698253
      9650 96698338
     10186 96699086
     10597 96700092
     12400 96698659
     12443 96700465
     14594 96699995

已选择10行。


执行计划
----------------------------------------------------------
Plan hash value: 3842462730

-------------------------------------------------------------------------------------------
| Id  | Operation                        | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                 |        |     1 |    76 |    55   (0)| 00:00:01 |
|*  1 |  VIEW                            |        |     1 |    76 |    55   (0)| 00:00:01 |
|*  2 |   WINDOW SORT PUSHED RANK        |        |     1 |   417 |    55   (0)| 00:00:01 |
|   3 |    NESTED LOOPS                  |        |     1 |   417 |    55   (0)| 00:00:01 |
|   4 |     TABLE ACCESS FULL            | POLY   |    13 |  2964 |     3   (0)| 00:00:01 |
|   5 |     TABLE ACCESS BY INDEX ROWID  | POINT  |     1 |   189 |    55   (0)| 00:00:01 |
|*  6 |      DOMAIN INDEX (Sel: .0000043)| A6_IX1 |       |       |     4   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("from$_subquery$_003"."rowlimit_$$_rownumber"通过SQL的执行计划可以看出,系统还是通过Rownum来进行分页<p><span>的,是否我可以理解Oracle封装了一下,做了个二次开发呢?</span></p><p><span><br></span></p><p></p><p><strong><span>----------------------------------------------------------------------------------</span></strong></p><p></p><p><span><span><br></span></span></p><p><span><span>Blog:               http://blog.csdn.net/linghe301</span></span></p><p><strong><span>----------------------------------------------------------------------------------</span></strong></p><br><p><span>2:获得第N条开始后的M条的语句</span></p><p><span>语法:offset N rows fetch next M rows only;</span></p><pre class="brush:php;toolbar:false">sde@PDBORCL> select a.objectid from poly b,point a where sde.st_within(a.shape,b.shape)=1  order by a.objectid offset 11 rows fetch next 10 rows only;

  OBJECTID
----------
     17833
     18358
     18710
     19544
     19719
     20030
     23028
     24001
     25139
     25257

已选择10行。


执行计划
----------------------------------------------------------
Plan hash value: 3842462730

-------------------------------------------------------------------------------------------
| Id  | Operation                        | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                 |        |     1 |    39 |    55   (0)| 00:00:01 |
|*  1 |  VIEW                            |        |     1 |    39 |    55   (0)| 00:00:01 |
|*  2 |   WINDOW SORT PUSHED RANK        |        |     1 |   417 |    55   (0)| 00:00:01 |
|   3 |    NESTED LOOPS                  |        |     1 |   417 |    55   (0)| 00:00:01 |
|   4 |     TABLE ACCESS FULL            | POLY   |    13 |  2964 |     3   (0)| 00:00:01 |
|   5 |     TABLE ACCESS BY INDEX ROWID  | POINT  |     1 |   189 |    55   (0)| 00:00:01 |
|*  6 |      DOMAIN INDEX (Sel: .0000043)| A6_IX1 |       |       |     4   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("from$_subquery$_003"."rowlimit_$$_rownumber"=0)
              THEN 11 ELSE 0 END +10 AND "from$_subquery$_003"."rowlimit_$$_rownumber">11)
   2 - filter(ROW_NUMBER() OVER ( ORDER BY "A"."OBJECTID")=0)
              THEN 11 ELSE 0 END +10)
   6 - access("SDE"."ST_WITHIN"("A"."SHAPE","B"."SHAPE")=1)


统计信息
----------------------------------------------------------
        647  recursive calls
          0  db block gets
       2481  consistent gets
          0  physical reads
          0  redo size
        457  bytes sent via SQL*Net to client
        359  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
         10  rows processed
关于Next的用法分为两步

第一步:先把过滤第1到第N-1的数据

第二步:然后再获得第N到M的数据

----------------------------------------------------------------------------------


Blog:               http://blog.csdn.net/linghe301

----------------------------------------------------------------------------------



3:获得前百分比N的语句

语法: fetch first N percent rows only;

sde@PDBORCL> select a.objectid from poly b,point a where sde.st_within(a.shape,b.shape)=1 order by a.objectid fetch first 10 percent rows only;

  OBJECTID
----------
      1326
      1790
      6511
      8761
      9650
     10186
     10597
     12400
     12443
     14594
     15163
     17833
     18358
     18710
     19544
     19719

已选择16行。


执行计划
----------------------------------------------------------
Plan hash value: 2419008321

-------------------------------------------------------------------------------------------
| Id  | Operation                        | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                 |        |     1 |    52 |    55   (0)| 00:00:01 |
|*  1 |  VIEW                            |        |     1 |    52 |    55   (0)| 00:00:01 |
|   2 |   WINDOW SORT                    |        |     1 |   417 |    55   (0)| 00:00:01 |
|   3 |    NESTED LOOPS                  |        |     1 |   417 |    55   (0)| 00:00:01 |
|   4 |     TABLE ACCESS FULL            | POLY   |    13 |  2964 |     3   (0)| 00:00:01 |
|   5 |     TABLE ACCESS BY INDEX ROWID  | POINT  |     1 |   189 |    55   (0)| 00:00:01 |
|*  6 |      DOMAIN INDEX (Sel: .0000043)| A6_IX1 |       |       |     4   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("from$_subquery$_003"."rowlimit_$$_rownumber"<br><p><span>从这些语句可以看到,原来使用比较麻烦的分页SQL写法,现在变得</span></p><p><span>比较简单和方便了。</span></p><p><span><br></span></p><p><span>目前来说,我在ArcGIS10.2.1 for Server进行Rest测试,还不支持该</span></p><p><span>方法,希望Esri能够尽快改进吧。</span></p><p></p><p><strong><span>----------------------------------------------------------------------------------</span></strong></p><p></p><p><span><span><br></span></span></p><p><span><span>Blog:               http://blog.csdn.net/linghe301</span></span></p><p><strong><span>----------------------------------------------------------------------------------</span></strong></p><br><p><span>另外需要说明一个问题。</span></p><p><span>很多情况下都会出现这种现象,比如在一个班级里面的数据成绩,从</span></p><p><span>最高排序有100、99、97、97、94等</span></p><p><span>那么,第一名就是100,第二名就是99,第三名应该是并列两个97,</span></p><p><span>那么在上面的语句中我们看到有一个ONLY关键字。</span></p><p><span><br></span></p><p><span>如果使用ONLY关键字,那么如果用户需要获得排序后的前三名,那么</span></p><p><span>只有100、99、97,显然这个不符合实际情况,所以用户应该使用</span></p><p><span>WITH TIES关键字,这样虽然获得前三名,得到的结果是真实的四个</span></p><p><span>数据。</span></p><pre class="brush:php;toolbar:false">sde@PDBORCL> select objectid,num from aaa;

  OBJECTID        NUM
---------- ----------
         1          1
         2          2
         3          3
         4          3
         5          3
         6          4
         7          4
         8          5

已选择8行。

sde@PDBORCL>
sde@PDBORCL> select  objectid,num from aaa order by num  fetch first 3  rows only;

  OBJECTID        NUM
---------- ----------
         1          1
         2          2
         3          3

sde@PDBORCL> select  objectid,num from aaa order by num  fetch first 3  rows with ties;

  OBJECTID        NUM
---------- ----------
         1          1
         2          2
         3          3
         4          3
         5          3

----------------------------------------------------------------------------------


Blog:               http://blog.csdn.net/linghe301

----------------------------------------------------------------------------------


PS:该功能目前可以在ArcGIS Desktop中使用,但是不能再


REST中使用。



ArcSDE10.2.1使用Oracle12c新特性分页

Stellungnahme
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Was sind die Grenzen der Verwendung von Ansichten in MySQL?Was sind die Grenzen der Verwendung von Ansichten in MySQL?May 14, 2025 am 12:10 AM

MySQLViewShavelimitations: 1) Sie sind supportallsqloperationen, restriktedatamanipulation ThroughviewswithjoinSuBqueries.2) Sie können sich angesehen, insbesondere mit der kompetenten Formata -Ansichten, die docrexQuqueriesorlargedatasets angezeigt werden

Sicherung Ihrer MySQL -Datenbank: Hinzufügen von Benutzern und Gewährung von BerechtigungenSicherung Ihrer MySQL -Datenbank: Hinzufügen von Benutzern und Gewährung von BerechtigungenMay 14, 2025 am 12:09 AM

OrteSermanagementinmysqlisicialforenHancingSecurityAnsuringEffizienceDatabaseoperation.1) Usecreateutertoaddusers, spezifizierende Connections mit 'localhost'or@'%'.

Welche Faktoren beeinflussen die Anzahl der Trigger, die ich in MySQL verwenden kann?Welche Faktoren beeinflussen die Anzahl der Trigger, die ich in MySQL verwenden kann?May 14, 2025 am 12:08 AM

Mysqldoes nicht imposeahardlimitontriggers, aber praktische Faktorendeterminetheireffectiveuse: 1) serverconfigurationImpactstriggermanagement;

MySQL: Ist es sicher, Blob zu speichern?MySQL: Ist es sicher, Blob zu speichern?May 14, 2025 am 12:07 AM

Ja, es ist safetostoreblobdatainmysql, butconsiderthesefactors: 1) StorageSpace: BloBScanconSignificantantspace, potenziellincreaseingCostsandSlowingPerformance.2) Leistung: größereRowsisDuetoBoBsMayslowdownquers.3) BackupandRecovery:

MySQL: Hinzufügen eines Benutzers über eine PHP -Weboberfläche hinzufügenMySQL: Hinzufügen eines Benutzers über eine PHP -Weboberfläche hinzufügenMay 14, 2025 am 12:04 AM

Das Hinzufügen von MySQL -Benutzern über die PHP -Weboberfläche kann MySQLI -Erweiterungen verwenden. Die Schritte lauten wie folgt: 1. Verbinden Sie eine Verbindung zur MySQL -Datenbank und verwenden Sie die MySQLI -Erweiterung. 2. Erstellen Sie einen Benutzer, verwenden Sie die Anweisung createUser und verwenden Sie die Funktion password (), um das Kennwort zu verschlüsseln. 3.. Verhindern Sie die SQL -Injektion und verwenden Sie die Funktion mySQLI_REAL_ESCAPE_STRING (), um die Benutzereingabe zu verarbeiten. V.

MySQL: Blob und andere Nicht-SQL-Speicher, was sind die Unterschiede?MySQL: Blob und andere Nicht-SQL-Speicher, was sind die Unterschiede?May 13, 2025 am 12:14 AM

Mysql'SbloBissableForstoringBinaryDatawithinarelationalDatabase, whilenosqloptionslikemongodb, Redis und CassandraofferFlexible, skalablessolutionenfornernstrukturierteData.blobissimplerbutcanslowdownscalgedlargedDataTTersClaTTersScalgedlargedDataTersClaTTersScalgedlargedDataTersClaTTERSCHITHLARGEGEGEBEN

MySQL Fügen Sie Benutzer hinzu: Syntax-, Optionen und Best Practices für SicherheitsverhältnisseMySQL Fügen Sie Benutzer hinzu: Syntax-, Optionen und Best Practices für SicherheitsverhältnisseMay 13, 2025 am 12:12 AM

ToaddauserinMysql, Verwendung: createUser'username '@' host'identifiedBy'password '; hier'Showtodoitesecurely: 1) choosethehostCrefulyTocon TrolAccess.2) setResourcelimits withOptionslikemax_queries_per_hour.3) UsSeStong, Uniquepasswords.4) Enforcesl/tlsConnectionsWith

MySQL: Wie vermeidet man String -Datentypen gemeinsame Fehler?MySQL: Wie vermeidet man String -Datentypen gemeinsame Fehler?May 13, 2025 am 12:09 AM

ToavoidCommonMistakeswithStringDatatypesinmysql, Verständnisstringtypenuances, ChoosetherightType, und ManageCodingandCollationsetingseffekt.1) UsecharforFixed-Länge-Strings, Varcharforvariable-Länge und Ventionlargerdata.2) -Tetcorrectaracters und Ventionlargerdata.2)

See all articles

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

Video Face Swap

Video Face Swap

Tauschen Sie Gesichter in jedem Video mühelos mit unserem völlig kostenlosen KI-Gesichtstausch-Tool aus!

Heißer Artikel

Nordhold: Fusionssystem, erklärt
4 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Flüstern des Hexenbaum
3 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

WebStorm-Mac-Version

WebStorm-Mac-Version

Nützliche JavaScript-Entwicklungstools

mPDF

mPDF

mPDF ist eine PHP-Bibliothek, die PDF-Dateien aus UTF-8-codiertem HTML generieren kann. Der ursprüngliche Autor, Ian Back, hat mPDF geschrieben, um PDF-Dateien „on the fly“ von seiner Website auszugeben und verschiedene Sprachen zu verarbeiten. Es ist langsamer und erzeugt bei der Verwendung von Unicode-Schriftarten größere Dateien als Originalskripte wie HTML2FPDF, unterstützt aber CSS-Stile usw. und verfügt über viele Verbesserungen. Unterstützt fast alle Sprachen, einschließlich RTL (Arabisch und Hebräisch) und CJK (Chinesisch, Japanisch und Koreanisch). Unterstützt verschachtelte Elemente auf Blockebene (wie P, DIV),

MantisBT

MantisBT

Mantis ist ein einfach zu implementierendes webbasiertes Tool zur Fehlerverfolgung, das die Fehlerverfolgung von Produkten unterstützen soll. Es erfordert PHP, MySQL und einen Webserver. Schauen Sie sich unsere Demo- und Hosting-Services an.

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Leistungsstarke integrierte PHP-Entwicklungsumgebung