If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > read text file with db2 stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-05, 08:00
tessyabs tessyabs is offline
Registered User
 
Join Date: Nov 2005
Posts: 10
Question read text file with db2 stored procedure

Hello!
I want to know if itīs possible to read a text file using a db2 stored procedure?

I konw how to make it using Oracle with the commands:
vr_file := utl_file.fopen('e:\ftp_home\utl_dados', vr_arquivo, 'W'); -> open file
utl_file.get_line(vr_file, vr_linha); -> read line
utl_file.put_line(vr_file, vr_linha); -> insert line
utl_file.fflush(vr_file2); -> "commit" line
utl_file.fclose(vr_file); -> close file

Is there anyone who know how I can make it?
Thanks!
Reply With Quote
  #2 (permalink)  
Old 11-09-05, 09:55
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by tessyabs
I want to know if itīs possible to read a text file using a db2 stored procedure?
yes
Quote:
Originally Posted by tessyabs
how I can make it?
Use Java or C to create a stored procedure
Reply With Quote
  #3 (permalink)  
Old 11-09-05, 10:38
tessyabs tessyabs is offline
Registered User
 
Join Date: Nov 2005
Posts: 10
Exclamation Sql Pl

But I want to know a way to read a text file using SQL PL.
Do you know if itīs possible?
Reply With Quote
  #4 (permalink)  
Old 11-09-05, 10:57
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
No, there are no means in SQL to do that.
Reply With Quote
  #5 (permalink)  
Old 11-09-05, 12:52
tessyabs tessyabs is offline
Registered User
 
Join Date: Nov 2005
Posts: 10
java stored procedure

Can you give me some example of a java stored procedure that read/write a text file?
Thanks
Reply With Quote
  #6 (permalink)  
Old 11-09-05, 13:59
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
There are some examples shipped with the DB2 Development Client; they're usually in sqllib/samples.
Reply With Quote
  #7 (permalink)  
Old 11-09-05, 14:14
tessyabs tessyabs is offline
Registered User
 
Join Date: Nov 2005
Posts: 10
send me the examples, please

I didnīt find any example at this directory...
Could you send me some examples?
Do you mind to send it to tessyabs@hotmail.com?
Or paste the examples here if you prefer... please!
Thanks!!
Reply With Quote
  #8 (permalink)  
Old 11-09-05, 17:18
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On