Skip to Main Content

Oracle Database Discussions

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!

Text Importer - reorganized the data

lov2tangoSep 14 2013 — edited Sep 15 2013


Hello,

I have searched high and low to solve this problem.

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.

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

For example, on the text file

1

2

3

4

5

On the table

4

5

1

2

3

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.

Thanks.  I really appreciate your help and advise.

lov2tango

Comments

473610
hi ,

Cd it was very usefull - u can keep the posting's regularly updated.

cheers
Nirmal
94799
Go for it.

The more clear, well explained examples of this subject the better - and you seem to be as well-qualified as anyone around here to be explaining this.
BluShadow
Looks good to me. Keep it up.
21205
To be continued ... ?

Absolutely!
Muthukumar S
Hi CD,

Too good. If you have any BLOG for you let us know. So that we can check that for regular updates on it.

Regards,
S.Muthukumar.
BluShadow
CD, can I suggest you just keep adding to this thread, so we can bookmark it and keep coming back for the latest. :)
RadhakrishnaSarma
Vow! Too good! Another AskTom?

Keep adding to this thread and we will come back to this for second volume of KT (Knowledge Transfer).

Cheers
Sarma.
cd_2
Since I don't have a blog (OMG, I'm so backwards ... ;-)), I'd second your suggestion.

@Radhakrishna: g Just a developer with a soft spot for regex.

C.

Message was edited by:
cd
32685
Excellent write up CD. Very nice indeed. Hopefully you'll be completing parts 2 and 3 some time soon. And with any luck, your article will encourage others to do the same....I know there's a few I'd like to see and a few I'd like to have a go at writing too :-)
390020
Hi, cd. Good work and kudos for sharing.

Just a suggestion:
Did you consider publishing it on the OTN or maybe on the Ora Mag?
http://www.oracle.com/technology/contact/otn_submit.html
cd_2
I can't really decide if my "article" would meet the publishing standards of Oracle Mag/OTN.

C.
ebrian
cd...thanks for taking the time to post this write-up for others to learn from.
474126
Hi Cd,

This article is really useful. Keep updating this thread, this will really help others to learn and understand more about regular expression.

Cheers,
Mohana
523648
thanks for the informative post.keep going
RadhakrishnaSarma
I'd like to have a go at writing too :-)
Very good move David. Would like to have some sessions on Performance Tuning where you can start to educate a dumb man in Performace Tuning.

Congrats cd. You not only took an initiative but also drove others for the same. Thanks for that too!

I also would like to make some suggestions about this good turn in forum. Any threads taken up like this should be updated by others too to add up what was missed out or what had been discovered from their experience.

What do you say guys?

Cheers
Sarma.
32685
...Performance Tuning where you can start to educate a dumb man in Performace Tuning.
I think there are many people on this forum who are much better placed to write articles on performance tuning :-)
I also would like to make some suggestions about this good turn in forum. Any threads taken up like this should be updated by others too to add up > what was missed out or what had been discovered from their experience.

What do you say guys?
What about setting up a wiki that we can collaborate on? I've not set one up before so I don't know exactly what can be done but I was thinking it could be a good way of making sure the articles are complete and accurate, giving everyone a chance to engage and provide their input. Each time there's a new article submitted, the person submitting it could update a thread on the forums page to let people know there's new material.

We could also have a list of suggestions for articles for people to submit, that way people can take on writing about things that they need to learn themselves and may not have considered writing about before, as well as subjects that they are knowledgeable on.

Just a thought....

p.s.

I wouldn't mind setting it up if anyone is up for it :-)
138365
Please take a look at this first part and let me know if you find this useful.
I found it very useful and looking forward for next part!

Cheers!
cd_2
Thanks for all the encouraging replies and suggestions, right now I don't have the capacity to start a wiki or open a blog, but I'd more than willing to add this and any future articles to such a site. Just to keep you updated, here's a list on things I want to write about in the next part:

-- count occurrence of a character
-- find last occurrence, "looking back"
-- swapping substrings
-- variable IN lists
-- LIKE and IN together
-- case insensitive search
-- phone numbers
-- checking inet values, like IP address, e-mail or URL
-- removing duplicate characters

If you have any ideas or example you think could be solved by regular expressions, please keep adding them to this thread.

C.
APC
Hi CD

I mentioned your article on my blog last night.

I would be quite happy to host your articles on Radio Free Tooting. To be frank it could do with more hard tech-y stuff.

Cheers, APC
cd_2
Why thank you. I don't have any objections if you want to host them, since the whole thing is about sharing knowledge. I'm also planning on translating this one into german and add them to a german speaking forum which is focused on Oracle.

C.
William Robertson
I could put it up on my site. Similar to APC, I haven't added enough new stuff recently.
cd_2
Again, no objections from my side - thanks for "replicating" that knowledge. Saves me the time to put something on the web myself. ;-)

C.
Gabe2
You have some typos in some of the patterns above the first addendum ... look for '$\+[0-9]+$' and '$[+-]?[0-9]+$'

Cheers.
cd_2
Thank you. Since my first pattern was using the "^" it could have happened when I was fixing my "*" mistake. Talking about peer review ... ;-)

C.
APC
We could also have a list of suggestions for articles for people to submit, that way
people can take on writing about things that they need to learn themselves and may >> not have considered writing about before, as well as subjects that they are
knowledgeable on.
There are a large number of initiatives out there already. There is Ask Tom, Oracle-L, teh Oracle FAQ forum, any number of bloggers. In this particular context there is Jonathan Lewis's Co-operative FAQ which does something very similar to what you're suggesting.

Which isn't to say that it's not a good idea, just that it will take commitment and energy both from the site admin and the contributors. As we know there are always more questioners than responders. And we will get the occasional espontáneo whose answers will need moderating. There is the risk of burnout and/or dilution.

But by all means set up a wiki or some similar site. You never know, it may be the thing that gets you your ACE-hood :)

Whilst I'm on the topic, I'm always happy to receive submissions from people who would like to present at the UKOUG Development SIG

Cheers, APC
533549
Very nice article helping others to learn new, useful Oracle functionality.

Thank you very much C.!
529476
Too usefull CD!!
I didnt check this article yesterday!!!!
You are really genius!!!!
May be you can now publish oracle magazine!!!!!
Then we will subscribe your magazine in our office
cd_2
Interesting, in the other thread you're accusing me of quarrelling with each and everybody and beeing immature ... could you make up your mind?

C.
orawarebyte
It seems to be very concrete model though i didnt read yet ..today is weekend i
will digest it (Y) , good job keep it up.

Khurram
44451
I agree with you Sarma!

Hat's off CD keep it up!
j4john
cd,

Excellent, thankyou very much for sharing your expertise.

Could I please point you to 432368 to get your insight on why I'm having a problem with Apex using a regex that works OK in a non-Apex environment?

Many thanks,

john
245482
And, as I mentioned in another thread, HJR's www.dizwell.com is another good option.
469875
:)
Mohammed Taj
Hi CD,

Too Good..


best regards
Taj
Keith Jamieson
This is just the sort of information I was looking for, and I think you should submit it to oracle magazine. I'm sure they'll like it, but they may ask for some amendments.
cd_2
Thank you. However I'm afraid Oracle Magazine won't take my article because they state that they will only publish articles that haven't been published anywhere else - and posting it here probably counts as publishing.

C.
Aman....
Hi CD,
Excellent!
Aman....
Mahmood Lebbai
I was trying to use regexp_substr function to retrieve the email domain (eg. yahoo.co.in for abc@yahoo.co.in)...but all I could get to was

"select regexp_substr('my email is abc@yahoo.co.in','@[^[:space:]]*',1,1) str from dual;" -- @yahoo.co.in

I am missing something here....Is there any ways that I could get what I just wanted.....Using trim function to remove the leading '@' is one way....

Can the regular expression do this for this situation?

Thanks.

Edited by: Mahmood Lebbai on Sep 22, 2008 10:40 PM
cd_2
Just some quick answers from my side, with REGEXP_SUBSTR and REGEXP_REPLACE:
WITH t AS (SELECT 'my email is abc@yahoo.co.in' col1
             FROM dual
          )
SELECT t.col1
     , LTRIM(REGEXP_SUBSTR(t.col1, '@[^[:space:]]+'), '@') solution_1
     , REGEXP_REPLACE(t.col1, '@([^[:space:]]+)|.', '\1') solution_2
  FROM t
;    

OL1                        SOLUTION_1                  SOLUTION_2
-------------------------- --------------------------- --------------------
y email is abc@yahoo.co.in yahoo.co.in                 yahoo.co.in
C.
Aketi Jyuuzou
similar threads used for same regex-logic.
700680
705978
Mahmood Lebbai
Hello CD,

Thanks for your answer...

Though i thought of a sort of solution_1, solution_2 (REGEXP_REPLACE(t.col1, '@([^[:space:]]+)|.', '\1') solution_2) was really astounding...

Thanks one more time....I learnt something today!

Edited by: Mahmood Lebbai on Sep 25, 2008 8:57 AM
BluShadow
cd, I think you need to edit your article to cater for the jive forum formatting. A lot of the {noformat}[ and ]{noformat} are being boogered up in the text. ;)
1 - 42
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 13 2013
Added on Sep 14 2013
5 comments
629 views