Something´s going wrong with select distinct (Oracle 10g)
Our database is oracle 10g release 2 and the query statement is:
select distinct last_name
from students;
and the query returns all of the last_names without an specific order..
If I execute the same query in oracle 9i the query returns all of the last_name in alphabetic order.
Why is it different on Oracle 10g?
See also this blog entry from Mr. Kyte.
C.
Similar Messages
-
Does anybody know if Windows 8 is causing a problem with iTunes? Many songs on my old iPod are now missing in my iTunes library and I can't find them anywhere. . Also, I have a new iPod and am afraid of using it for fear of something else going wrong.
Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.
-
OraException from Command.ExecuteReader with SELECT DISTINCT
Hello
I am trying to fill an OraDataReader object from a OraCommand object.
It appears that whenever the statement includes a SELECT DISTINCT, the command fails (even though the SQL statement works fine when executed e.g. in TOAD)
Dim Conn As OraConnection = New Oracle.DataAccess.Client.OraConnection("[Valid connection string]")
Conn.Open()
Dim Command As OraCommand = New OraCommand()
Command.CommandType = CommandType.Text
Command.CommandText = "select DISTINCT nvl(SUBFAMILY_COMPETENCY_ID, 0) SUBFAMILY_ID, nvl(NAME, ' ') NAME, FAMILY_COMPETENCY_ID FAMILY_ID " & _
" from TAXONOMY_RELATIONAL, COMPETENCY " & _
" where TAXONOMY_RELATIONAL.CL_ID = :1 " & _
" AND COMPETENCY.cl_id (+) = TAXONOMY_RELATIONAL.cl_id and COMPETENCY.language_id (+) = :2 " & _
" and COMPETENCY.COMPETENCY_ID (+) = TAXONOMY_RELATIONAL.SUBFAMILY_COMPETENCY_ID " & _
" order by FAMILY_ID, SUBFAMILY_ID"
Command.Parameters.Add("@CL_ID", context.Session!CLID)
Command.Parameters.Add("@LANGUAGE_ID", context.Session!LANGUAGEID)
Dim DataReader As OraDataReader = Command.ExecuteReader(CommandBehavior.CloseConnection)
An Oracle.DataAccess.Client.OraException is raised when executing the last statement, but no further details are given in the error message. The stack trace begins as follows
[OraException]()
Oracle.DataAccess.Client.OraException.HandleErrorHelper(Int32 errCode, OraConnection conn, IntPtr opsErrCtx, IntPtr opsSqlCtx, Object src, String procedure) +639
Oracle.DataAccess.Client.OraCommand.ExecuteReader(+737)
Oracle.DataAccess.Client.OraCommand.ExecuteReader(CommandBehavior behavior) +8
The exception disappears as soon as I remove the DISTINT keyword from my SQL statement.
Is this a bug or am I doing something wrong?
Thanks for help,
Bernt FischerThis issue is same as the one mentioned in the thread with title "Problem with 'Select distinct'" and the fix would be available in the next release.
-
Something is completely wrong with the itunes ios7
Something is completely wrong with the itunes on my phone after I downloaded ios7. I click on a song and it doesn't play. I close itunes, reopen it, and it starts playing a different song from the album shown in the photo. What's up?
Hello,
'''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings and disables most add-ons (extensions and themes).
''(If you're using an added theme, switch to the Default theme.)''
If Firefox is open, you can restart in Firefox Safe Mode from the Help menu by clicking on the '''Restart with Add-ons Disabled...''' menu item:<br>
[[Image:FirefoxSafeMode|width=520]]<br><br>
If Firefox is not running, you can start Firefox in Safe Mode as follows:
* On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
* On Mac: Hold the '''option''' key while starting Firefox.
* On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
''Once you get the pop-up, just select "'Start in Safe Mode"''
[[Image:Safe Mode Fx 15 - Win]]
'''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
When you figure out what's causing your issues, please let us know. It might help others with the same problem.
Thank you. -
What is going wrong with this config ??
Hello guys,
I am busting my head to find out what is going wrong with this config and cant figure it out since i am not an advanced cisco technician.
Problem is that i cant access the 94.70.142.127 server that is supposed to be in a DMZ zone.
I know it is a bit chaotic but would really appreciate any help since i am running on a deadline.
I am building the config step by step and although it seems to be working access to the server all of the sudden is denied.
No idea if its a NAT issue a firewall issue or a security audit issue.
There are 3 vlans.
Vlan 1 is the inside network.
Vlan 2 is the DMZ server
Vlan 3 is the Management Network.
thanks in advance
Building configuration...
Current configuration : 11796 bytes
! Last configuration change at 11:28:33 PCTime Fri Jan 4 2013 by admin
! NVRAM config last updated at 11:27:51 PCTime Fri Jan 4 2013 by admin
version 12.4
no service pad
service tcp-keepalives-in
service tcp-keepalives-out
service timestamps debug datetime msec localtime show-timezone
service timestamps log datetime msec localtime
service password-encryption
service sequence-numbers
hostname R1
boot-start-marker
boot-end-marker
security authentication failure rate 3 log
security passwords min-length 8
logging message-counter syslog
logging buffered 4096 informational
enable secret 5 $1$oT7y$BwhdEjMJfAaTQI3dzDVwP.
no aaa new-model
memory-size iomem 10
clock timezone PCTime 2
clock summer-time PCTime date Mar 30 2003 3:00 Oct 26 2003 4:00
crypto pki trustpoint TP-self-signed-2567543707
enrollment selfsigned
subject-name cn=IOS-Self-Signed-Certificate-2567543707
revocation-check none
rsakeypair TP-self-signed-2567543707
crypto pki certificate chain TP-self-signed-2567543707
certificate self-signed 01
30820244 308201AD A0030201 02020101 300D0609 2A864886 F70D0101 04050030
31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274
69666963 6174652D 32353637 35343337 3037301E 170D3133 30313032 30383431
35335A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649
4F532D53 656C662D 5369676E 65642D43 65727469 66696361 74652D32 35363735
34333730 3730819F 300D0609 2A864886 F70D0101 01050003 818D0030 81890281
8100ABA4 B7FFF4F1 9FBE79D8 2CEBCA68 A14BE3AB DBF770C2 EB35A954 B271AE3E
F8485837 F2E8566B 66E5EF6B BCFCDFA3 8F6F91F3 FD8E3015 879A67F5 85DD95F5
C26875C0 2202CA6C CE95888F 545AB4F6 6F708A0E C65E78D1 60967480 5589F5EE
80505E46 8767CE2C 37C994FE AB555AF0 BA4C4679 63FF7641 34FFF6EF 3EC38006
46B90203 010001A3 6C306A30 0F060355 1D130101 FF040530 030101FF 30170603
551D1104 10300E82 0C52312E 646F636E 65742E67 72301F06 03551D23 04183016
8014F0DE 85318FB3 70C36B4A FEB4B0CA 446025F0 329C301D 0603551D 0E041604
14F0DE85 318FB370 C36B4AFE B4B0CA44 6025F032 9C300D06 092A8648 86F70D01
01040500 03818100 5D76D5F4 5FB659C3 1E5B3777 420E1703 CD019889 AE79390D
A2AA4D26 AD9913B4 B3292277 97ACACDD D7093465 78279B4D 5FAC0A21 EFBF3B74
6A25BC5B ACFB648F 08F92678 00BB495C 037DEAF7 C5910944 3D2C0643 EA19E9BD
0AFE5423 AADBB3C2 B2C94296 DABE0D3D 6438F7A8 32B0A92B 3E8E0D26 635070A3
ACF87E49 65A9E468
quit
no ip source-route
ip cef
no ip bootp server
ip domain name docnet.gr
ip name-server 195.170.0.1
no ipv6 cef
username admin privilege 15 view root secret 5 $1$Lny5$et1FhWOpIKOOYRUtN89H10
archive
log config
hidekeys
ip tcp synwait-time 10
ip ssh version 2
class-map type inspect match-any WebService
match protocol http
match protocol https
class-map type inspect match-all sdm-cls-sdm-pol-NATOutsideToInside-1-1
match class-map WebService
match access-group name WebServer
class-map type inspect match-all ccp-cls-sdm-pol-NATOutsideToInside-1-1
match access-group name Spoofing
class-map type inspect match-any CCP-Voice-permit
match protocol h323
match protocol skinny
match protocol sip
class-map type inspect match-any tcp-udp
match protocol http
match protocol https
match protocol dns
match protocol icmp
class-map type inspect match-all ccp-cls--3
match access-group name mng-out
match class-map tcp-udp
class-map type inspect match-all ccp-cls--2
match access-group name mng-self
class-map type inspect match-all ccp-cls--4
match access-group name mng-out-drop
class-map type inspect match-any ccp-cls-insp-traffic
match protocol cuseeme
match protocol dns
match protocol ftp
match protocol h323
match protocol https
match protocol icmp
match protocol imap
match protocol pop3
match protocol netshow
match protocol shell
match protocol realmedia
match protocol rtsp
match protocol smtp extended
match protocol sql-net
match protocol streamworks
match protocol tftp
match protocol vdolive
match protocol tcp
match protocol udp
class-map type inspect match-all ccp-insp-traffic
match class-map ccp-cls-insp-traffic
class-map type inspect match-any http-https-DMZ
match protocol http
match protocol https
class-map type inspect match-all sdm-cls--2
match class-map http-https-DMZ
match access-group name web_server
class-map type inspect match-any MySQLService
match protocol mysql
class-map type inspect match-all sdm-cls--1
match class-map MySQLService
match access-group name DMZtoMySQL
class-map type inspect match-any ccp-cls-icmp-access
match protocol icmp
match protocol tcp
match protocol udp
class-map type inspect match-all ccp-icmp-access
match class-map ccp-cls-icmp-access
class-map type inspect match-all ccp-invalid-src
match access-group 100
class-map type inspect match-all sdm-nat-https-1
match access-group 102
match protocol https
class-map type inspect match-all ccp-protocol-http
match protocol http
policy-map type inspect ccp-permit-icmpreply
class type inspect ccp-icmp-access
inspect
class class-default
pass
policy-map type inspect sdm-pol-NATOutsideToInside-1
class type inspect ccp-cls-sdm-pol-NATOutsideToInside-1-1
drop
class type inspect sdm-cls-sdm-pol-NATOutsideToInside-1-1
inspect
class type inspect sdm-nat-https-1
inspect
class class-default
drop
policy-map type inspect ccp-inspect
class type inspect ccp-invalid-src
drop log
class type inspect ccp-protocol-http
inspect
class type inspect ccp-insp-traffic
inspect
class type inspect CCP-Voice-permit
inspect
class class-default
drop
policy-map type inspect ccp-permit
class class-default
drop
policy-map type inspect sdm-policy-sdm-cls--1
class type inspect sdm-cls--1
inspect
class class-default
drop
policy-map type inspect ccp-policy-ccp-cls--1
class class-default
drop
policy-map type inspect ccp-policy-ccp-cls--3
class type inspect ccp-cls--3
inspect
class class-default
drop
policy-map type inspect sdm-policy-sdm-cls--2
class type inspect sdm-cls--2
inspect
class class-default
drop
policy-map type inspect ccp-policy-ccp-cls--2
class type inspect ccp-cls--2
inspect
class class-default
drop
policy-map type inspect ccp-policy-ccp-cls--5
class class-default
drop
zone security out-zone
zone security in-zone
zone security dmz-zone
zone security mng
zone-pair security ccp-zp-self-out source self destination out-zone
service-policy type inspect ccp-permit-icmpreply
zone-pair security sdm-zp-NATOutsideToInside-1 source out-zone destination in-zone
service-policy type inspect sdm-pol-NATOutsideToInside-1
zone-pair security ccp-zp-in-out source in-zone destination out-zone
service-policy type inspect ccp-inspect
zone-pair security ccp-zp-out-self source out-zone destination self
service-policy type inspect ccp-permit
zone-pair security zp-dmz-to-outside source dmz-zone destination out-zone
service-policy type inspect ccp-inspect
zone-pair security zp-outside-to-dmz source out-zone destination dmz-zone
service-policy type inspect sdm-pol-NATOutsideToInside-1
zone-pair security sdm-zp-dmz-zone-in-zone source dmz-zone destination in-zone
service-policy type inspect sdm-policy-sdm-cls--1
zone-pair security sdm-zp-in-zone-dmz-zone source in-zone destination dmz-zone
service-policy type inspect sdm-policy-sdm-cls--2
zone-pair security sdm-zp-dmz-zone-self source dmz-zone destination self
service-policy type inspect ccp-policy-ccp-cls--1
zone-pair security sdm-zp-mng-self source mng destination self
service-policy type inspect ccp-policy-ccp-cls--2
zone-pair security sdm-zp-mng-out-zone source mng destination out-zone
service-policy type inspect ccp-policy-ccp-cls--3
zone-pair security sdm-zp-out-zone-mng source out-zone destination mng
service-policy type inspect ccp-policy-ccp-cls--5
interface Null0
no ip unreachables
interface BRI0
no ip address
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
encapsulation hdlc
shutdown
isdn termination multidrop
interface ATM0
no ip address
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
no atm ilmi-keepalive
interface ATM0.1 point-to-point
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
pvc 8/35
pppoe-client dial-pool-number 1
interface FastEthernet0
interface FastEthernet1
interface FastEthernet2
switchport access vlan 3
spanning-tree portfast
interface FastEthernet3
switchport access vlan 2
interface Vlan1
description $FW_INSIDE$
ip address 192.168.0.1 255.255.255.0
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
ip nat inside
ip virtual-reassembly
zone-member security in-zone
ip tcp adjust-mss 1412
interface Vlan2
description $FW_INSIDE$
ip address 192.168.1.1 255.255.255.0
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
ip nat inside
ip virtual-reassembly
zone-member security dmz-zone
interface Vlan3
description $FW_INSIDE$
ip address 10.0.10.1 255.255.255.0
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
ip nat inside
ip virtual-reassembly
zone-member security mng
interface Dialer0
description $FW_OUTSIDE$
ip address negotiated
no ip redirects
no ip unreachables
no ip proxy-arp
ip mtu 1452
ip flow ingress
ip nat outside
ip virtual-reassembly max-reassemblies 64
zone-member security out-zone
encapsulation ppp
dialer pool 1
dialer-group 1
ppp authentication chap pap callin
ppp chap hostname [email protected]
ppp chap password 7 0918425001505245
ppp pap sent-username [email protected] password 7 13511B4B1359417D
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 Dialer0
ip route 10.0.10.0 255.255.255.0 Vlan3
no ip http server
ip http secure-server
ip nat inside source list 1 interface Dialer0 overload
ip nat inside source static 192.168.0.101 94.70.142.113
ip nat inside source static 192.168.1.102 94.70.142.127
ip access-list extended DMZtoMySQL
remark CCP_ACL Category=128
permit ip host 192.168.1.102 host 192.168.0.101
ip access-list extended Spoofing
remark CCP_ACL Category=128
permit ip 10.0.0.0 0.255.255.255 any
permit ip 192.168.0.0 0.0.255.255 any
permit ip 172.16.0.0 0.15.255.255 any
ip access-list extended VTY_incoming
remark CCP_ACL Category=1
permit ip host 10.0.10.2 any
ip access-list extended WebServer
remark CCP_ACL Category=128
permit ip any host 192.168.1.102
ip access-list extended mng-out
remark CCP_ACL Category=128
permit ip 10.0.10.0 0.0.0.255 any
ip access-list extended mng-out-drop
remark CCP_ACL Category=128
permit ip any any
ip access-list extended mng-self
remark CCP_ACL Category=128
permit ip any any
ip access-list extended web_server
remark CCP_ACL Category=128
permit ip 192.168.0.0 0.0.0.255 host 192.168.1.102
logging 10.0.10.2
access-list 1 remark INSIDE_IF=Vlan1
access-list 1 remark CCP_ACL Category=2
access-list 1 remark VLan 1 Access
access-list 1 permit 192.168.0.0 0.0.0.255
access-list 1 remark VLan 3 Access
access-list 1 permit 10.0.10.0 0.0.0.255
access-list 1 remark Vlan 2 Access
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 100 remark CCP_ACL Category=128
access-list 100 permit ip host 255.255.255.255 any
access-list 100 permit ip 127.0.0.0 0.255.255.255 any
access-list 102 remark CCP_ACL Category=0
access-list 102 permit ip any host 192.168.0.101
dialer-list 1 protocol ip permit
no cdp run
control-plane
banner login ^CWARNING!!!This is a highly monitored private system. Access is prohibited!!^C
line con 0
no modem enable
line aux 0
line vty 0 4
access-class VTY_incoming in
password 7 12292504011C5C162E
login local
transport input ssh
scheduler max-task-time 5000
ntp authentication-key 1 md5 10603D29214711255F106B2677 7
ntp authenticate
ntp trusted-key 1
ntp master 2
endHello karolos,
Here is the thing.
You said you are trying to access 94.70.142.113 and that is a server on the DMZ but based in your configuration that is not true
ip nat inside source static 192.168.0.101 94.70.142.113
So 192.168.0.101 is on Vlan 1 witch is the in-zone
interface Vlan1
description $FW_INSIDE$
ip address 192.168.0.1 255.255.255.0
security in-zone
If you got confused with the security zone that the host is assigned to then just add the following and it should work
ip access-list extended WebServer
permit ip any host 192.168.0.101
Regards -
My Blueyonder email is coming in but won't send, where am I going wrong with the settings?
We don't know. You didn't tell us what those settings are. However, if you contact your email provider, Blueyonder, they should be able to help you. Check their website where they may even have information on how to configure Mail for their site.
-
Something is going on with my Itunes...I open up my itunes and the loading icon [the rainbow wheel] starts up. Everything freezes except the mouse i cant restart it, close it, nothin. im forced to press the power button to restart it. ive tryed it with nothing but the itunes only processing and it dosent seem to help. ive been with this problem for the last two weeks, and ive seen that everything on my macbook works fine as long as i dont open up my itunes but i really want it to work again. i dont know if its crashing or if its in a hang, but im hopin someone can help me on this, or wondering if i should take it to the nearst Apple store to get it checked at the genius bar. Help me?
Hello errow,
Your display problem looks very familiar to mine. You can see some pictures here on this topic: http://discussions.apple.com/thread.jspa?threadID=2741232&tstart=15
Best regards,
Frans. -
something has gone wrong with my external hard drive after my macbook battery went off.. now i cannot paste or create new folder. Does anyone know how to fix this?
Bus powered external drive?
Backups?
Does Disk Utility can see and repair the drive or not?
Also try here in future: MacBook Pro -
Something has gone wrong with my version of pages since I did an update on 18th January
Something has gone wrong with my version of pages since I did an update on 18th January. I get an error message
"You need a newer version of Pages to open this document"You have 2 versions of Pages on your Mac.
Pages 5 is in your Applications folder.
Pages '09/'08 is in your Applications/iWork folder.
You have a problem when opening a file with the wrong version.
Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
Pages 5 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
Anything that is saved to iCloud is also converted to Pages 5 files.
All Pages files no matter what version and incompatibility have the same extension .pages.
Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
Note: Apple has removed over 100 features from Pages 5 and added many bugs:
http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
Archive/trash Pages 5, after exporting all Pages 5 files to Pages '09 or Word .docx, and rate/review it in the App Store, then get back to work.
Peter -
My iPhone 5 is blocked and goes wrong with IOS 8.2.
My iPhone 5 is blocked and goes wrong with IOS 8.2. How can officially return to IOS 7.12?
The phone goes slow, hard contacts are loaded, the phone got stuck a few times.
I would like to return to the IOS 7.12, but can not. Problems have occurred since the IOS8, but I hoped to solve with iOS 8.1 or 8.2. On the contrary, the situation was worsened.
What can I do?I have a 64GB model
Contacts are displayed harder. Not appear depending on usage, as IOS 7.
All functions of the smartphone go late.
Now I installed iOS 8.1 and did not improve anything
It happens rarely that's right, the smartphone to block everything and need to restart. But we claim that we have an Apple that should function without resets
I understand that the processor does not support well IOS8 iPhone 5, but I want to return to IOS 7 as the smartphone was perfect
Apple must know these problems and have to accept a return to IOS7 for iPhone 5
They were given a warning only 3, 3 g, 4, 4s
I have friends with iPhone 5 that meet the same problem and they will return to IOS7 if possible
I think that Apple has a problem in this regard
Another version of IOS 8 can not resolve the situation, because it seems that the processor can not handle this software
I would be very happy if Apple will understand the situation, and someone at Apple will give me an answer or a solution -
Installing Discoverer with Database Version Oracle 10g Express Edition
Hello,
Is it possilbe to install Discoverer with database version Oracle 10g Express Edition? I have Oracle Fusion Middleware 11.1.1.1.0 on my Windows XP machine as well. If so, can someone please provide me a link to the Discoverer download.
Regards,
KellyNote that the Personal Edition of the database is 'the most powerful' version, in that it contains all features and options of the Enterprise Edition (expect RAC and Enterprise Manager packs)
As such, the Personal Edition, at a mere USD$400-500 is one of the most cost effective for-fee products that Oracle has in it's inventory. It is targeted at the developer. And it comes with the complete set of Sample Data, whereas XE has a very limited subset (since it does not support all functionality).
Express Edition is indeed free, but it is not supported, and can not be patched. OTOH it does have a lighter footprint.
Again, I am not sure whether Disco 11g is compatible with Express Edition. (It's on my schedule for December ...) -
How can I send e-mail with attachment from oracle 10g?
How can I send email with attachment from oracle 10g?
hi you can achieve the same thing from database tier of unix.
-
Also, I have a timer that lets me know how long the trigger has been active. I want to know if it is possible if that time would be reset everytime the trigger goes off.
Attachments:
Code.vi 113 KB1. Do not run using the Continuous Run button! This is intended only for certain types of trouble shooting and not for normal operation.
2. Put a while loop around your entire program. Add a stop button wired to the stop terminal of the loop.
3. Then you can replace all the feedback nodes with one shift register with the input expanded to five elements. Sum the three bottom ones for your averaging.
4. Nothing is wrong with the In Range and Coerce. You should only check it when you have data. That is what the Data Available output from Trigger and Gate is for.
5. I am not sure what you want to reset for your timer or exactly when, but it should be possible.
6. I did not try to figure it all out but you may not need the timer while loop once you wrap the loop suggested in 2 around the rest of the code. You may be able to move the shift registers to the outer loop.
Lynn -
Issue with "Select Distinct" query in Oracle 10g against Oracle 9i
Hi,
I would appreciate if some one help me here because it is really urgent.
We are upgrading our database from 9i to 10g.
There are the "Select distinct" queries in the code which populated the grid on the applications screens. We found a difference in 9i and 10g the way the result is populated for these queries. If "Select Distinct" query wihtout a order by clause is executed in 9i then the result is automatically sorted. But Oracle 10g does not do this.
We can change the queries adding order by clause but we are almost at the end of the testing and want to know if there is any way that we can do this from database settings. Would there be any impact of these settings change on overall operation of Oracle 10g?
I would appreciate if some one can help me here.
Thanks,
Dineshthen the result is automatically sorted.No. Oracle may have done a sort operation to perform the distinct, but it still did not guarantee the order of your results.
In 10g and in 9i, if you want your results in a certain order you must use order by. -
"connect by" problem with "select distinct"
When I run the following SQL (using "Scott" DB):
select *
from emp
where deptno = 30 or mgr is null
start with mgr is null
connect by prior empno = mgr
order siblings by ename
I get the results one would expect. The President is first and all those reporting to him/her are listed in correct sequence.
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO
7839,KING,PRESIDENT,,11/17/1981,5000,10
7698,BLAKE,MANAGER,7839,5/1/1981,2850,30
7499,ALLEN,SALESMAN,7698,2/20/1981,1600,300,30
7900,JAMES,CLERK,7698,12/3/1981,950,30
7654,MARTIN,SALESMAN,7698,9/28/1981,1250,1400,30
7844,TURNER,SALESMAN,7698,9/8/1981,1500,0,30
7521,WARD,SALESMAN,7698,2/22/1981,1250,500,30
However, when I run the same query but make it "select distinct" I get the following:
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO
7499,ALLEN,SALESMAN,7698,2/20/1981,1600,300,30
7698,BLAKE,MANAGER,7839,5/1/1981,2850,,30
7900,JAMES,CLERK,7698,12/3/1981,950,,30
7839,KING,PRESIDENT,,11/17/1981,5000,,10
7654,MARTIN,SALESMAN,7698,9/28/1981,1250,1400,30
7844,TURNER,SALESMAN,7698,9/8/1981,1500,0,30
7521,WARD,SALESMAN,7698,2/22/1981,1250,500,30
Why would adding "distinct" to the select cause the result to be sorted STRICTLY by ename (per "order siblings by...")?
Finally, if I "select distinct" but don't specify any "order" I get this, in NO APPARENT order:
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO
7499,ALLEN,SALESMAN,7698,2/20/1981,1600,300,30
7521,WARD,SALESMAN,7698,2/22/1981,1250,500,30
7654,MARTIN,SALESMAN,7698,9/28/1981,1250,1400,30
7698,BLAKE,MANAGER,7839,5/1/1981,2850,,30
7839,KING,PRESIDENT,,11/17/1981,5000,,10
7844,TURNER,SALESMAN,7698,9/8/1981,1500,0,30
7900,JAMES,CLERK,7698,12/3/1981,950,,30
Thanks in advance for any insight offered!
-Geneyou have to specify what is going to be the distict field.No you don't. DISTINCT keyword applies to the whole SELECT list. See your own link.
In any case this does not appear to have anything to do with what you SELECT, rather that the SORT UNIQUE caused by the DISTINCT keyword appears to prevent the ORDER SIBLINGS BY clause from working correctly.
Not really sure why you need DISTINCT in this example, no doubt this is being applied elsewhere. Given that you have duplicates in the rowset and that hierarchical query now supports views, perhaps it would be more efficient to apply DISTINCT keyword first, something like...
SELECT e.*
FROM (SELECT DISTINCT e.*
FROM emp e
WHERE e.deptno = 30
OR e.mgr IS NULL) e
START WITH e.mgr IS NULL
CONNECT BY PRIOR e.empno = e.mgr
ORDER SIBLINGS BY e.ename;
Alternatively you could skip ORDER SIBLINGS BY clause and use SYS_CONNECT_BY_PATH function to get your order, something like...
SELECT e.*
FROM (SELECT DISTINCT e.*,
SYS_CONNECT_BY_PATH () path
FROM emp e
WHERE e.depno = 30
OR e.mgr IS NULL
START WITH e.mgr IS NULL
CONNECT BY PRIOR e.empno = e.mgr) e
ORDER BY e.path
Padders
Maybe you are looking for
-
Windows Media Player DRM prevents me watching football on my iMac - HELP!!
Hi there - I'm having some real problems trying to watch my beloved Scottish Football games live (or recorded) on my iMac. I'm a new mac user. Used to be a pc owner (my appologies there) and watched all my games with no problem. Games are shown eithe
-
The tabs/sites are no longer saved when closing the browser. The 'help' section on this issue is terrible. This is a MAJOR defect with version 4.0 (along with some others which I hope will be smoothed out with the next update). If this feature is not
-
FDM crashed after trying to open locations and mappings. Login page error
Whilst trying to open mappings for a given location, FDM has crashed. We have restarted the FDM service, however despite the service running cannot log into FDM any more. Internet Explorer now displays the following error: Internet Explorer: "Applica
-
2 Factor Authentication YouTube Uploads.
I have gone to Google and put iMovie in for two factor authentication. When ever I close down iMovie I have to go back to Google revoke the old one and do it again. So here is the question. When I put the Authentication code in for Youtube after I c
-
Change the field format when Excel Downloading..
Hi. In ALV, when downloads, some fields change into date format. ex. In screen : 37-1 In excel : jan-37. How to correct it? let's me know..plz.. Thank you in advance. Best regards. kil