Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 23rd, 2004, 04:40 AM
million1977 million1977 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Aberdeen, Scotland
Posts: 48 million1977 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 51 m 3 sec
Reputation Power: 5
PL/SQL: Quick question on 'Table of records'

Hi,

is there any way to sort a PL/SQL table of records by a specific record field??

Many thanks

Reply With Quote
  #2  
Old September 23rd, 2004, 07:40 AM
Ankur Gupta Ankur Gupta is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 Ankur Gupta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The only way for sorting is using order by clause, you can use it while retrieving or inserting records.
If there is some other scenario then please write briefly.

Regards
Ankur

Reply With Quote
  #3  
Old September 23rd, 2004, 07:40 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
ORDER BY clause only available for this purpose, you can use it in both SQL and PL/SQL. could you please explain your question little bit more???

Reply With Quote
  #4  
Old September 23rd, 2004, 08:19 AM
santosh_pai santosh_pai is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 14 santosh_pai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I guess you are talking about the PL/SQL table created inside the code ( within packages / Proedures )
Then there is no way to sort the PL/SQL table .
Think of PL/SQL table as a array storing the data.. If you want to sort out the data from this you would have to write your own sorting algo

Cheers
Santosh

Reply With Quote
  #5  
Old September 24th, 2004, 02:55 AM
million1977 million1977 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Aberdeen, Scotland
Posts: 48 million1977 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 51 m 3 sec
Reputation Power: 5
Quote:
Originally Posted by santosh_pai
I guess you are talking about the PL/SQL table created inside the code ( within packages / Proedures )
Then there is no way to sort the PL/SQL table .
Think of PL/SQL table as a array storing the data.. If you want to sort out the data from this you would have to write your own sorting algo

Cheers
Santosh


Yes, that's what I was talking about- not a database table that can be sorted with ORDER BY, but a table created like this:

Code:
  TYPE t_nom_rec IS RECORD (obj_id           t_nom.obj_id%TYPE,
                            telex_id         t_nom.telex_id%TYPE,
                            facility_desc    t_facility.facility_desc%TYPE, 
                            shipper_desc     t_shipper.shipper_desc%TYPE, 
                            nomination_type  t_lookup.lk_desc%TYPE, 
                            effective_hour   t_nom.effective_hour%TYPE,    
                            quantity         t_nom.quantity%TYPE,
                            approved_ind     t_nom.approved_ind%TYPE,
                            verified_ind     t_nom.verified_ind%TYPE,
                            superseded_ind   t_nom.superseded_ind%TYPE,
                            agg_ind          t_nom.agg_ind%TYPE,
                            rejected_ind     t_nom.rejected_ind%TYPE);
  TYPE t_nom_tab IS TABLE OF t_nom_rec INDEX BY BINARY_INTEGER;
  v_nom_tab t_nom_tab;


So there's no way of ordering by field without using your own algorithm? That's bad news

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > PL/SQL: Quick question on 'Table of records'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway