Home » SQL & PL/SQL » SQL & PL/SQL » storing a file content in DatabaseColumn
storing a file content in DatabaseColumn [message #41191] Mon, 09 December 2002 06:28 Go to next message
Venkat
Messages: 110
Registered: February 2001
Senior Member
can i store and retrieve the whole content of a file in Database Column.If so, how? brief help in this is greatly appreciated.

thanks in advance
Re: storing a file content in DatabaseColumn [message #41202 is a reply to message #41191] Tue, 10 December 2002 01:13 Go to previous messageGo to next message
Amitabha
Messages: 14
Registered: May 2002
Junior Member
use LONG datatype in Table column and sroe file contents into that.

From SQL 2000 characters is your limit.

From PL/SQL you can insert strings of upto 32767 characters.

Above this you will need to go to something like Pro*C.

Try the following for the PL/SQl example

create table temp (x varchar2(10),y long);
/

CREATE OR REPLACE PROCEDURE inslong(a IN VARCHAR2,b IN VARCHAR2)
IS
BEGIN
INSERT INTO temp VALUES (a,b);
COMMIT
END inslong;

call inslong with parameters :
exec inslong('xyz',long_data_of_file);
for reading file contents you need pro 'c for binary files, utl_file for texts.

Amitabha.
Re: storing a file content in DatabaseColumn [message #41206 is a reply to message #41191] Tue, 10 December 2002 02:34 Go to previous message
Venkat
Messages: 110
Registered: February 2001
Senior Member
it works....but...i'll get back...:)

thanks
Previous Topic: How can i get table info.?
Next Topic: Dirty Read
Goto Forum:
  


Current Time: Thu May 16 01:20:20 CDT 2024