Home » SQL & PL/SQL » SQL & PL/SQL » want to shift row
want to shift row [message #196734] Fri, 06 October 2006 22:48 Go to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
hello,
i want to shift 4th row to be in 3rd.
how can i do??

ORDER_ CLIENT dely_date
------ ------ ----------
O19001 C00001 20/01/1996
O19002 C00002 27/01/1996
O46865 C00003 20/02/1996
O19003 C00001 07/04/1996
O46866 C00004 22/05/1996
O19008 C00005 26/05/1996

6 rows selected

thanxx in advance Razz
Re: want to shift row [message #196739 is a reply to message #196734] Fri, 06 October 2006 23:16 Go to previous messageGo to next message
shahidmughal
Messages: 91
Registered: January 2006
Location: Faisalabad Pakistan
Member

hi

i think you want to sort data

according to order_client

use order by at the end of your query

as following instance

select order_client,delay_date
from tabname
order by order_client;

by sorting your output will be according to your desire


i hope it will work

regards
Muhammad Shahid Mughal
Re: want to shift row [message #196741 is a reply to message #196739] Fri, 06 October 2006 23:28 Go to previous messageGo to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
thanku Mr.Shahid
if i want to shift 6th row to 5th & 5th row to 6th then,
how will i do?
Re: want to shift row [message #196742 is a reply to message #196741] Fri, 06 October 2006 23:38 Go to previous messageGo to next message
shahidmughal
Messages: 91
Registered: January 2006
Location: Faisalabad Pakistan
Member

hi

i checked your data

therefore i have given that suggestion

if you sort your data all rows will be shifted

regards

Muhammad Shahid Mughal
Re: want to shift row [message #196744 is a reply to message #196742] Fri, 06 October 2006 23:56 Go to previous messageGo to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
i m very sorry, i unable to clear my question to you.
but i want to shift a row by other not to sort it out.
suppose i want to shift down one row by other,
then what step i do?

thanx in advance Cool
Re: want to shift row [message #196754 is a reply to message #196744] Sat, 07 October 2006 01:06 Go to previous messageGo to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
hello orafaq team,
can any one please help me to over come by this problem.
i want to shiftdown row by other row, dnt use order by clause,
please revert it me back
thanxx
Re: want to shift row [message #196830 is a reply to message #196754] Sun, 08 October 2006 02:12 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
shift = sort. Oracle, as a relational database, has no order in its rows and you cannot enforce it in inserts or updates. A table is a collection of records without any guarantee towards order. It is you who does the sorting via an ORDER BY statement. So, why won't you use an order by? If you don't use an ORDER BY you cannot sort them.

MHE

[Updated on: Sun, 08 October 2006 02:12]

Report message to a moderator

Re: want to shift row [message #196960 is a reply to message #196830] Mon, 09 October 2006 06:13 Go to previous message
be2sp1
Messages: 52
Registered: September 2005
Location: India
Member
ashish_pass1,

Oracle documentation says that there is no gaurantee with respect to the retreived records until ORDER BY clause is used. You may get the rows order as same (retreival and insertion) but its not mandatory and could be different in cases when Indexes, partitioning come into picture.

Thanks.
Previous Topic: Duplicate key error on merge with unique source data
Next Topic: Deletion of a BLOB data type
Goto Forum:
  


Current Time: Sat Dec 03 14:13:51 CST 2016

Total time taken to generate the page: 0.08753 seconds