Arrays

5 pts.
Tags:
Arrays
How do I build a table in descending key sequence when reading a file that is in a different key sequence than the table being built?

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m not sure i understand the question – you say you are building a table but you don’t say how you are building a table. Is this a memory array? Is it a physical table in a database? A spreadsheet or what? If you are reading a file with data in no particular sequence and storing that data in a database table then the order it is stored in the table really makes no difference. A query statement against the table to retrieve the data is where you would sort the data with an “order by” clause. I would like to know how you are populating your table from the file and tell me also what kind of file you are using. If the file is just plain text, comma delimited text, etc. There are a bazillion ways to manipulate data. Please be more specific.

Also, if you are creating a database table from the data your db software should possibly have indexing features to improve the data retrieval with your select statement containing the order by clause. If you insist on making the table be “sequential” the create a temporary table from the file and then create a permanent table from the temporary table by using a select statement that orders the data, e.g.:

table A with one column has 4 rows with (apparently) nonsequetial data –

Widget_ID
————–
4
2
1
3

You would create a table B with the data sorted in descending order like this:

create table B as select * from table A order by widget_id desc

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    Is this a COBOL question?
    51,365 pointsBadges:
    report
  • Vatchy
    Since the title of your post is "Arrays" I assume you are talking about an array. Load the array from the file and then use the SORTA keyword to sort the array.
    1,410 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following