Home » SQL & PL/SQL » SQL & PL/SQL » File count UTL_FILE
File count UTL_FILE [message #231874] Wed, 18 April 2007 12:51 Go to next message
yog_23
Messages: 79
Registered: March 2007
Member
Trying to figure out what's the best way to get the number of records in a file using UTL_FILE. Don't wanna read each line and loop to get the count. Any ideas ?

Thank you
Yog
Re: File count UTL_FILE [message #231876 is a reply to message #231874] Wed, 18 April 2007 12:54 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
>Don't wanna read each line and loop to get the count. Any ideas ?

call DBMS_PSYCHIC to automagically get the correct answer.

[Updated on: Wed, 18 April 2007 12:54] by Moderator

Report message to a moderator

Re: File count UTL_FILE [message #231877 is a reply to message #231876] Wed, 18 April 2007 12:56 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Laughing
Re: File count UTL_FILE [message #231878 is a reply to message #231874] Wed, 18 April 2007 13:01 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
alternatively -
record count = file_size / row_size
Re: File count UTL_FILE [message #231879 is a reply to message #231878] Wed, 18 April 2007 13:23 Go to previous messageGo to next message
yog_23
Messages: 79
Registered: March 2007
Member
Psychic ? LOL

What's wrong dude ?

I am just interested in the count and not the content
Re: File count UTL_FILE [message #231880 is a reply to message #231874] Wed, 18 April 2007 13:25 Go to previous messageGo to next message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
But how will you get the count without actually counting?

Same principle as counting the rows in a table...

Or counting the number of playing cards in a pile on the floor.
Re: File count UTL_FILE [message #231883 is a reply to message #231880] Wed, 18 April 2007 13:41 Go to previous messageGo to next message
yog_23
Messages: 79
Registered: March 2007
Member
ok i see..

That is precisely what I want to know.

Is there any function that does that.

If its not available, then there is no option except to read ...lol..

thank you
Re: File count UTL_FILE [message #231888 is a reply to message #231883] Wed, 18 April 2007 13:51 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No, it seems you don't see.
If any function exists it must read the whole file, in any language, any system, any what you want.

In Oracle, the fastest way is to use external table.

Regards
Michel
Re: File count UTL_FILE [message #231895 is a reply to message #231888] Wed, 18 April 2007 14:53 Go to previous messageGo to next message
yog_23
Messages: 79
Registered: March 2007
Member
well..don't say me that

unix had count functions which i have used before.

LOL.
Re: File count UTL_FILE [message #231898 is a reply to message #231895] Wed, 18 April 2007 15:03 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And this function reads the whole file.

Regards
Michel
Previous Topic: Random Sample
Next Topic: how can we call java code in oracle procedure
Goto Forum:
  


Current Time: Thu Dec 08 20:30:22 CST 2016

Total time taken to generate the page: 0.11102 seconds