oracle 11g

当sql语句中不加order by的时候,好像是按rowid的顺序返回结果的。
我也看过一些相关的文档,oracle的官方意思就是不加order by,就不保证输出的顺序

那么,问题来了:
如果现在我select XXX,一组结果出来,顺序是.......A....B.....
那么接下来我做什么操作,再做同样一句select,怎么才能让结果变成....B...A.....
Notice1: 操作中请勿修改表的主键,不要用DDL,只用select * from A;得到结果
Notice2:
create table A(id NUMBER(20) primary key, name VARCHAR2(30));
insert into A values(1,'one');
insert into A values(2,'two');select * from A;

这个问题我试验了一些操作,比如update,insert,delete一两条数据啊,都不能做到改变两个结果的相对顺序。

Given this requirement:

Do not change the SQL select * from table A. 
Change the table A to change the results order

the answer is a clear and definite: this is not possible.


(Keeping my initial answer as a reference)

"I know the results will be sorted by rowid" - no, they are not.

The rows will be returned in any order the database thinks is the most efficient.

There is no, absolutely no, guarantee that rows are returned in any specific order unless you specify an ORDER BY.

The ONLY way to get a specific order is to use an ORDER BY.

http://stackoverflow.com/questions/20186673/in-oracle-11g-how-to-change-the-order-of-the-results-of-a-sql-without-order-by

rowid是标识行的唯一性,格式:data object number(6个字符)+relative file number(3个字符)+block number(6个字符)+row number(3个字符)
数据库的理论基础就是集合论,本质上就是无序的,不使用order by(子查询或查询)是不能保证顺序,你把数据不停无序删除再加回估计就能看到这个现象,但大部分时候都是在磁盘上的次序,这跟数据库怎么读数据有关

http://zhidao.baidu.com/link?url=F6VOk6Khxty3AmU9CgVRrdaBf7UBSsQU6wKLnmqE2XxQ75P_4nTtqYMARQAGOJk6q-cTYxXK1jiiaYQT1DHaGvEBdYo9mj571VrusfBd2JO

In Oracle 11g, how to change the order of the results of a sql without “order by”?(转)的更多相关文章

  1. Oracle 11g rac开启归档

    Oracle 11g rac开启归档 查看目前归档状态 #节点1 ykws1 SQL> archive log list; Database log mode No Archive Mode A ...

  2. oracle 11g rac R2 for linux change(public,vip)IP ,hostname (oracle 11g rac R2 修改公有,虚拟,私有IP,网卡)

    结构如下: 说明: 节点IP,主机名的修改步骤来自ORACLE support文档: 如何修改集群的公网信息(包括 VIP) (文档 ID 1674442.1) 实验环境情况如下: 实验 节点名称 数 ...

  3. 聊聊Oracle 11g的Snapshot Standby Database(上)

    Oracle 11g是Data Guard的重要里程碑版本.在11g中,Active DataGuard.Advanced Compression等特性大大丰富了Data Guard的功能和在实践领域 ...

  4. Oracle 11g 虚拟列 Virtual Column介绍

    Oracle 11G 虚拟列 Virtual Column Oracle 11G 在表中引入了虚拟列,虚拟列是一个表达式,在运行时计算,不存储在数据库中,不能更新虚拟列的值. 定义一个虚拟列的语法: ...

  5. Zero Downtime Upgrade of Oracle 10g to Oracle 11g Using GoldenGate — 3

    DDL Setup Steps SQL> grant execute on utl_file to ggs; Grant succeeded. Create GLOBALS file [orac ...

  6. ORACLE 11G R2 RAC classical install OGG12.1(LINUX) 经典抽取模式单项同步配置OGG12.1

    博文结构图如下: 一.环境描述以及注意事项 1.1 环境简介 IP 系统 Oracle版本 OGG版本 源端 172.16.10.16/36 RHEL6.5 oracle11204 12.1 目标端 ...

  7. Oracle 11g trace events

    oracle的events,是我们在做自己的软件系统时可以借鉴的 Oracle 11g trace eventsORA-10001: control file crash event1ORA-1000 ...

  8. oracle 11g r2 rac到单实例的dg

    oracle 11g r2 rac到单实例的dg 1 主备环境说明 rac环境--primary CentOS release 6.5 (Final)hostname rac1 rac2ip 10.* ...

  9. Oracle 11g Enhancements in AWR Baselines

    Enhancements in AWR Baselines A baseline is any set of snapshots taken over a period of time. The sn ...

随机推荐

  1. 银行家算法java实现

    关于银行家算法的理论知识,课本或者百度上有好多资料,我就不再多说了,这里把我最近写的银行家算法的实现带码贴出来. 由于这是我们的一个实验,对系统资源数和进程数都指定了,所以这里也将其指定了,其中系统资 ...

  2. ExternalInterface的简单使用方法

    ExternalInterface的简单使用方法 使用ExternalInterface调用JavaScript方法-无返回值flex代码------------------<mx:Button ...

  3. WinForm 国际化开发一例

    1.新建一个WinForm程序(在中文版的Windows下),如下,添加1个Button和1个Label 设置Form1的localizable属性为True(Form1的properties里的De ...

  4. redis入门(转)

    Redis介绍 Redis是一种高级key-value数据库.它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富.有字符串,链表.哈希.集合和有序集合5种.支持在服务器端计算集合 ...

  5. lsb_release: command not found 解决方法(转)

    问题:通过lsb_release -a 是查看linux系统版本时报错,具体的解决办法如下: [root@localhost ~]# lsb_release -a-bash: lsb_release: ...

  6. ebay的api开发技术说明,有点乱

    使用eBay API的基本步骤引入 开始eBay API,例如,以下基本步骤需要: 1.    注册开发者账号: https://developer.ebay.com/join/Default.asp ...

  7. [LeetCode160]Intersection of Two Linked Lists

    题目: Write a program to find the node at which the intersection of two singly linked lists begins.   ...

  8. C语言习题 链表建立,插入,删除,输出

    Problem B: C语言习题 链表建立,插入,删除,输出 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 222  Solved: 92 [Subm ...

  9. unity3d中让物体显示和隐藏

    unity3d中让物体显示和隐藏的方法 gameObject.renderer.enabled //是控制一个物体是否在屏幕上渲染或显示  而物体实际还是存在的 仅仅是想当于隐身 而物体本身的碰撞体还 ...

  10. Codeforces 437E The Child and Polygon(间隔DP)

    题目链接:Codeforces 437E The Child and Polygon 题目大意:给出一个多边形,问说有多少种切割方法.将多边形切割为多个三角形. 解题思路:首先要理解向量叉积的性质,一 ...