Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best practice to save lasting time of .... ?

2877737Mar 19 2018 — edited Mar 19 2018

Hi,

I have to keep in my table time of lasting tasks in my system. Time of lasting a task it means time, from start to end the task.

I wondered which data type to apply ? Varchar2 ? - it's problematic to count avg time, max time etc. Data ? it's not an hour Timestamp ? it's not an hour ?

Which practice is the best ? Mayby there is any standard ?

Thx.

Paul.

This post has been answered by thatJeffSmith-Oracle on Mar 19 2018
Jump to Answer

Comments

jgarry

Oracle tables are heap tables, there is no intrinsic order.

You can either use the order by statement when you select, or use an index-organized table with an order by.  The correct answer depends on what exactly you intend to do with the table, why you feel there should be an inherent order.

unknown-7404
I was trying to import a large text file to a table.  The text file has more that 1 million lines.  The table has only 1 column to hold one line from the text file.  I made sure that the CLEAR TABLE is checked before I start the process.  Commit every 100.

Oracle has no 'CLEAR TABLE' command so you must be using some tool or GUI front-end you haven't told us about.

If you commit every 100 you will just slow things down so just issue a commit at the end of the data load.

When I checked the resulting table, I noticed that it reoganized the sequence of lines from the text file.

No - Oracle doesn't 'organize' or 'reorganize' the rows. It just dumps them into a table; there is NO first row or last row. Just like if you throw a bunch of tennis balls into a basket you won't know afterward which one was the first ball you threw in.

How can I import from the text file onto a table without reorganizing the data.  I really need the data on this table to be in the same line sequence as the text file.  I also tried commit every 1 record.

Just use my 'tennis ball' example from above. If you want the balls to have an order you need to write a number on each one as you throw it into the basket. Then later you can find ball #1, #37 or sort the balls in order if you want.

For your use case that means add a second column to the table (e.g. LINE_NO) and use an Oracle sequence to 'number' them.

lov2tango

Now I understand.  Thank you very much!

lov2tango

I did used PL/SQL Developer's Text Importer feature.

unknown-7404
I did used PL/SQL Developer's Text Importer feature.

Thanks for sharing but how is that relevant? Your problem is that you need to create your own ordering since the database doesn't create one for you. What tool you use to import the data doesn't really matter unless that tool won't allow you to create an ordering.

1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 16 2018
Added on Mar 19 2018
9 comments
682 views