Blob column type question
Hello all,
We are storing some images in Oracle 9i as BLOB type. The actual size for most of them is about 150K (0.15MB). However, when the upload is complete the size of each file in db is approximately 3.5 MB. Is something is wrong with table definition/storage?
Thank you,
Sonya
Mark,
here are my answers:
What is the full Oracle version? 9i
What is the table definition?
IMAGE_NO NOT NULL NUMBER(12)
IMAGE_PAGE NOT NULL NUMBER(3)
IMAGE_NAME NOT NULL VARCHAR2(50)
IMAGE_DATA BLOB
What is the tablespace extent management method in use and parameters?
HEADER_FILE 12
HEADER_BLOCK 331939
BYTES 458752
BLOCKS 56
EXTENTS 7
INITIAL_EXTENT 65536
NEXT_EXTENT
MIN_EXTENTS 1
MAX_EXTENTS 2147483645
How are you measuring the size of the LOB after loading? used this function dbms_lob.getlength(image_data)
Edited by: sonya795 on Aug 25, 2008 4:18 PM
Similar Messages
-
Hello All :
I have been trying to figure out for a simple code I can use in my JSP to upload a file (of any format) into an Oracle table with a BLOB column type. I have gone through a lot of existing forums but couldnot find a simple code (that doesnot use Servlet, for eg.) to implement this piece.
Thanks a lot for your help !!Hi.
First of all to put a file into Oracle you need to get the array of bytes byte[] for that file. For this use for example FileInputStream.
After you get the byte array try to use this code:
try {
Connection conn = myGetDBConnection();
PreparedStatement pstmt = conn.prepareStatement("INSERT INTO table1 (content) VALUES(?)");
byte[] content = myGetFileAsBytes();
if (content != null) {
pstmt.setBinaryStream(0, new ByteArrayInputStream(content), content.length);
pstmt.close();
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
}or instead of using ByteArrayInputStream try pstmt.setBinaryStream(0, new FileInputStream(yourFile), getFileSize());Hope this will help...
regards, Victor Letunovsky -
Oracle Views with Column type as CLOB
I have a table which has a column of type CLOB. I am trying to creating a view which has all the columns of that table.
I get
Warning: View created with compilation errors.
SQL> show errors;
No errors
Can any one help me how to create a view on a table wihich has a CLOB/BLOB column types. Also how to select the clob data from the view
sreeAre you the owner of the view you created?
Check out the documentation for the SHOW command.
If you omit schema, SHOW ERRORS assumes the object is located in your current schema. -
Associative array type for each blob column in the table
i am using the code in given link
http://www.oracle.com/technology/oramag/oracle/07-jan/o17odp.html
i chnages that code like this
CREATE TABLE JOBS
JOB_ID VARCHAR2(10 BYTE),
JOB_TITLE VARCHAR2(35 BYTE),
MIN_SALARY NUMBER(6),
MAX_SALARY NUMBER(6),
JOBPIC BLOB
CREATE OR REPLACE PACKAGE associative_array
AS
-- define an associative array type for each column in the jobs table
TYPE t_job_id IS TABLE OF jobs.job_id%TYPE
INDEX BY PLS_INTEGER;
TYPE t_job_title IS TABLE OF jobs.job_title%TYPE
INDEX BY PLS_INTEGER;
TYPE t_min_salary IS TABLE OF jobs.min_salary%TYPE
INDEX BY PLS_INTEGER;
TYPE t_max_salary IS TABLE OF jobs.max_salary%TYPE
INDEX BY PLS_INTEGER;
TYPE t_jobpic IS TABLE OF jobs.jobpic%TYPE
INDEX BY PLS_INTEGER;
-- define the procedure that will perform the array insert
PROCEDURE array_insert (
p_job_id IN t_job_id,
p_job_title IN t_job_title,
p_min_salary IN t_min_salary,
p_max_salary IN t_max_salary,
p_jobpic IN t_jobpic
END associative_array;
CREATE OR REPLACE package body SHC_OLD.associative_array as
-- implement the procedure that will perform the array insert
procedure array_insert (p_job_id in t_job_id,
p_job_title in t_job_title,
p_min_salary in t_min_salary,
p_max_salary in t_max_salary,
P_JOBPIC IN T_JOBPIC
) is
begin
forall i in p_job_id.first..p_job_id.last
insert into jobs (job_id,
job_title,
min_salary,
max_salary,
JOBPIC
values (p_job_id(i),
p_job_title(i),
p_min_salary(i),
p_max_salary(i),
P_JOBPIC(i)
end array_insert;
end associative_array;
this procedure is called from .net. from .net sending blob is posiible or not.if yes howOk, that won't work...you need to generate an image tag and provide the contents of the blob column as the src for the image tag.
If you look at my blog entry -
http://jes.blogs.shellprompt.net/2007/05/18/apex-delivering-pages-in-3-seconds-or-less/
and download that Whitepaper that I talk about you will find an example of how to do what you want to do. Note the majority of that whitepaper is discussing other (quite advanced) topics, but there is a small part of it that shows how to display an image stored as a blob in a table. -
Store the value in BLOB column data type
Hi All,
I have a file of about 5MB. I want to store this in BLOB column data type of a table.
Can we compress this file to store and when we take uncompress the same...or how do we do it.
and what is the procedure to store this....
pls. help me
Thanks,
NareshHi skud
i juast want to store the agent code to variable.if i did get ur point...
Why don't u just use a simple assign statment for example...
DECLARE
V_VALUE NUMBER;
BEGIN
V_VALUE := LC354 ; -- IF it was a value as LC354 static i mean
-- or u could use any value
V_VALUE := :ur_form_item_name; --- if it was dynamic
END;That's it .
Hope this helps...
Regards,
Ammatu Allah. -
How to classify the type of the file which stored in Blob column
I have a table which will stored various kinds of documents (e.g. PDF, MS word, MS Excel etc...) into blob column.
How can I read them from the database through web and display them into the correct software? i.e. when the file is PDF, it can be opened by Acrobat reader and .doc can be opened by MS word
thanks.A bit off the topic of Oracle Text, but the client typically determines the application that will be used (you have your apps associated with file extensions on your machine and I have mine). Are you having problems related to this, or is this a question in advance of trying it out?
Thanks,
Ron -
How to get MIME type of BLOB column.
Hi,
I have created OS directory folder(C:\Audio) in my c drive and having list of audio files in different format, Also I have created one table to store the audio files with Blob column.
So, i need to know the MIME type of the BLOB column during the run time.Saroj Nayak wrote:
I have created OS directory folder(C:\Audio) in my c drive and having list of audio files in different format, Also I have created one table to store the audio files with Blob column.
So, i need to know the MIME type of the BLOB column during the run As recommended in the About BLOB Support in Forms and Reports documentation, use additional columns to store file metadata like the MIME type. -
How to get the File-Type from a BLOB-Column
Hi all,
I have the database table with the BLOB-Column. In this column are Word/Pdf/Excel/... files can be stored.
Now I want to open these Files from Webforms.
I can download the file from database to the client and then open the file with client_ole2.CREATE_OBJ('Word.Application');
But I can not be sure that the file is a Word-Document.
How can I know which application is saved in the BLOB-column?
RegardsHi Francois,
thank you.
Unfortunatelly I do not know the interMedia functions. Can you send me an example with interMedia?
I am working with your solution with WEBUTIL_HOST.blocking.
But when I do not give the extension for the file, in that the BLOB will be temporary stored, I get to see the Windows "Select Program..." window. When I select Word or anything else then the file will be opened, but the locking does not working.
Any ideas?
Regards -
I have a question for you: Inserting Word document in BLOB column
Hey Experts,
I have found a good info and a sample on how to achieve this on
http://www.sys-con.com/java/source/5-6/code.cfm?Page=76.
declare
f_lob bfile;
b_lob blob;
begin
insert into sam_emp(empno,ename,resume)
values ( 9001, 'Samir',empty_blob() )
return risumi into b_lob;
f_lob := bfilename( 'MY_FILES', 'MyResume.doc' );
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile
( b_lob, f_lob, dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
I have a jsp project and the users ( on the client side)must be
able to create a word document and send it to the server with an
uplaod servlet. With another servlet or jsp i want to process
this word document in BLOB column using JAVA. The sample above
uses PL/SQL to achieve this. Is there a way i can do this in my
servlet/jsp to do the same thing?
Any hints are welcome!The option should be visible here: http://support.mozilla.com/en-US/kb/Printing%20a%20web%20page#w_print-window-settings
Print range section - Lets you specify which pages of the current web page are printed:
* Select '''All''' to print everything.
* Select '''Pages''' and enter the range of pages you want to print. For example, selecting "from 1 to 1" prints the first page only.
* Select '''Selection''' to print only the part the page you've highlighted.
Does it work for you? -
Can i move blob column one tablespace to another tablespace
When I ruining the following script
ALTER TABLE T_Transaction_Image
MOVE LOB(RCSCOMPRESSED_IMAGE,CAMERA_PHOTO_1,CAMERA_PHOTO_2,NUMBER_PLATE)
STORE AS TABLESPACE IMAGE
I found error
ORA-22853: invalid LOB storage option specification
Here we have more than one column having BLOB data type .
Question
I want to know can i move multiple column in single alter table ?
and how can i move blob column one tablespace to another tablespace
Thanks in advance
Edited by: abdul moyed on Feb 3, 2011 6:33 PMhttp://decipherinfosys.wordpress.com/2007/11/21/moving-lob-column-to-a-different-tablespace/
Regards
Asif Kabir -
Problem displaying PDF stored in BLOB column
Hello everyone.
I've been trying to follow this tutorial http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::p11_question_id:232814159006 on displaying PDFs stored in BLOB columns. This is being performed on Apex 4.2, with my DB running 11g. I've got my procedure, which I'll post below:
create or replace procedure "PDF" (p_id IN gvo_documents.doc_id%type)
is
l_lob blob;
l_amt number default 30;
l_off number default 1;
l_raw raw(4096);
begin
select contents into l_lob
from gvo_documents
where doc_id = p_id;
-- make sure to change this for your type!
owa_util.mime_header( 'application/pdf' );
begin
loop
dbms_lob.read( l_lob, l_amt, l_off, l_raw );
htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
l_off := l_off+l_amt;
l_amt := 4096;
end loop;
exception
when no_data_found then
NULL;
end;
end;
I am trying to run this through a PL/SQL dynamic region and while I don't receive any error's, the content displayed is a huge mess of garbled text and odd characters. I've tried to run this procedure on numerous other document types, including word files and jpeg images, all with the necessary changes in my procedure, and regardless of what I use, I still get a large mess of strange characters. Does anyone have any information or ideas about why this is happening?If I understand correctly, your requirements needs to be broken down into two problems:
1) click link that pops up a window displaying a new APEX page
2) an APEX page the displays the document, not downloads it.
I haven't done #1 (yet).
However, you may be able to generate a URL that points to the new page as part of the SELECT statement for the Report.
This has a related question, but no answer yet:
open pdf in popup browser window
The key is target="_blank" for the anchor tag.
To generate the URL, you should use the APEX_UTIL.prepare_URL() function.
If that doesn't work, a Dynamic Action that does some magical JavaScript stuff may be needed.
For #2, I lost the URL that showed how to display a PDF as part of a "form" page.
From what I remember:
Start with a blank page with one blank HTML region (all the Items go in the HTML region)
Add an Item for the PK/Doc_ID
part I forgot Create a Data Manipulation Process
- Automated Row Fetch
- On Load - After Header
- (stuff for your table/view)
part I forgot Create an (I believe) "File Browser" item type. For Settings:
- Storage Type "BLOB column specified in Item Source" (and place the column name of the BLOB there)
- MIME Type Column: (column name) -- since you have multiple types, this is a MUST HAVE
- Filename Column: (column name) -- I highly recommend you have this.
- Content Disposition == INLINE <-- this is the kicker
Also, you will need a Browser Plugin for each of the MIME Types (otherwise, the browser may try to 'download' the file)
Browsers can handle Image types internally. Adobe's plugin can handle PDFs. I don't know about Word/Excel.
Again, I don't remember the exact details, but that should cover most of it.
MK -
Apache FOP PDF Save in BLOB column
Hi,
I just want to call Apache FOP in an APEX process to create PDF reports and save these reports in a BLOB column in the same database. So I can email these reports in another process using APEX_MAIL. Does anyone know a way to achieve this?
ThanksIf I understand correctly, your requirements needs to be broken down into two problems:
1) click link that pops up a window displaying a new APEX page
2) an APEX page the displays the document, not downloads it.
I haven't done #1 (yet).
However, you may be able to generate a URL that points to the new page as part of the SELECT statement for the Report.
This has a related question, but no answer yet:
open pdf in popup browser window
The key is target="_blank" for the anchor tag.
To generate the URL, you should use the APEX_UTIL.prepare_URL() function.
If that doesn't work, a Dynamic Action that does some magical JavaScript stuff may be needed.
For #2, I lost the URL that showed how to display a PDF as part of a "form" page.
From what I remember:
Start with a blank page with one blank HTML region (all the Items go in the HTML region)
Add an Item for the PK/Doc_ID
part I forgot Create a Data Manipulation Process
- Automated Row Fetch
- On Load - After Header
- (stuff for your table/view)
part I forgot Create an (I believe) "File Browser" item type. For Settings:
- Storage Type "BLOB column specified in Item Source" (and place the column name of the BLOB there)
- MIME Type Column: (column name) -- since you have multiple types, this is a MUST HAVE
- Filename Column: (column name) -- I highly recommend you have this.
- Content Disposition == INLINE <-- this is the kicker
Also, you will need a Browser Plugin for each of the MIME Types (otherwise, the browser may try to 'download' the file)
Browsers can handle Image types internally. Adobe's plugin can handle PDFs. I don't know about Word/Excel.
Again, I don't remember the exact details, but that should cover most of it.
MK -
Changing a VARCHAR(2) to BLOB Data type
I am trying to change a VARCHAR(2) data type into a BLOB. I have researched the web and found what I thought was the solution. That was to create a new column that was a BLOB, copy the information from the column I what to modify into it, then delete the original column and rename the BLOB column to that original name.
However I am getting error messages such as…
ORA-00904: "CUSTOMER2"."Cust_Firstname": invalid identifier
When I issue this statement:
UPDATE CUSTOMER2 SET "CUSTOMER2"."Cust_Firstname"=Temp_Name;
or
ORA-00904: "CUSTOMER2"."Temp_Name": invalid identifier
When I issue this statement:
UPDATE CUSTOMER2 SET "CUSTOMER2"."Cust_Firstname"="CUSTOMER2"."Temp_Name";
Or
And I have gotten an error message saying update failed was expecting a numeric got BLOB.
I have UPDATED the table…
SQL>Alter table CUSTOMER2 ADD Temp_Name BLOB;
Table altered.
0.74 seconds
Does anyone have any ideas? All help would be very much appreciated!
-RobertHello Robert,
first, I don't see which part of your question concerns APEX. There is {forum:id=75} where you probably get best input for your problem.
Anyhow, just a few things you might think about before posting there.
I am trying to change a VARCHAR(2) data type into a BLOBI'm not sure if you really want this to be a BLOB. Ususally, if text fields get too small, you'd use CLOB. Again, I'd guess the 4000 bytes you can easily store in a VARCHAR2 (not VARCHAR(2), right? this would be a two byte text field) would be sufficient for what I would expect to find in a column named "Cust_Firstname".
UPDATE CUSTOMER2 SET "CUSTOMER2"."Cust_Firstname"=Temp_Name;Is this the actual code? I guess you didn't create the column "Cust_Firstname" with double quotes. Double quotes enable case sensitive handling, so "Cust_Firstname" is different from "cust_firstname" or "CUST_FIRSTNAME". The latter version would be the default if no quotes are used, i.e. everything is handled as it were in upper case.
Concerning your assignment order: If "Temp_Name" is the new BLOB column, you wouldn't want "Cust_Firstname" to be overwritten with that empty value.
If I understood you right, you want to transfer the value from "Cust_Firstname" (which is VARCHAR2) to "Temp_Name", which you created as BLOB. You should change the order in the update statement then.
-Udo -
BLOB Columns Inserts/Updates ???
Please let me know how SQL*Loader can run updates to just the blob columns without truncation/replace. We want to do incremental updates to the BLOB column without truncation/replace. If this is not possible please let me know any other process which can do this with the best performance we have huge amount of data that needs to be processed. Please let me know .......
e-mail from the developer.
Is there something that we or the DBA’s can do to improve performance on these types of inserts/updates with blobs? Currently we are executing batches of inserts/update to the 5 IMAGE_* tables and those are triggering inserts into the IMAGE*_HISTORY tablesHandle: user01
Status Level: Newbie
Registered: Jun 10, 2004
Total Posts: 252
Total Questions: 28 (24 unresolved)
so many questions & so few answers.
EXTERNAL TABLE is available option
How fast it is depends upon the SQL & design implementation -
Pls hlep, Error message "we don not currently support clop or blob column"
I currently use the Oracle SQL Developer Ver.2.1-32 Bit on Dell PC.
After I got the query result,I got the problem ; Disable to Export to any file type, there is message "No valid columns available for export, we don not currently support clop or blob columns"
Remark : I don't have problem if use select *, but if I select some columns and add where condition the this message error will pop-up.
Sample of my query as below attachment
SELECT ColumnName_1, ColumnName_2, ColumnName_3 FROM TableName1
WHERE UPDATE_DATE >= to_date('2011-02-10 01:00:00', 'YYYY-MM-DD HH24:MI:SS')
AND ColumnName_1 IN 'xxx'
group by ColumnName_1, ColumnName_2, ColumnName_3 ;
SELECT ColumnName_1, ColumnName_2, ColumnName_3,COUNT(*) FROM TableName1
WHERE UPDATE_DATE >= to_date('2011-02-10 01:00:00', 'YYYY-MM-DD HH24:MI:SS')
AND ColumnName_1 IN 'xxx'
group by ColumnName_1, ColumnName_2, ColumnName_3
HAVING COUNT(*)>2 ;Last confirm question.
Can I download the new version latest 3.0 EA4 for free ? Is this SW is free download, isn't it ?
If yes, Pls suggest the link to download for me pls.
Remark :
I'm working for Seagate Thailand company, my current officail version from company download link is Ver.2.1.1.64.
Thank you in advance for your support.
Maybe you are looking for
-
How can i block a vendor for Down payment? Both f-47, f-48 and automatic f100 should not work for this vendor. please tell me the settings Thanks in Advance.
-
Download content locally when needed by running task sequence functionality with Windows PE.
I am trying to understand what happens when the "Download content locally when needed by running task sequence" option in chosen on a task sequence deployment. My assumption is that any needed packages would not be identified and downloaded until tas
-
Can datatype of a field be changed
Hi I have a live table, but i need to change a field from type number(1) to type number(3). Is there any way to change datatype? Or do i need to delete field and then add the new one? Thanks Mark
-
Position of eps-files in anchored frame
Hello, I'm sorry but the subject was too large to put it in the subject-field. Subject: position of eps-files (Mac Os 9, Illustrator 9.0, preview tiff black/white) is not correct after saving eps-files (preview macintosh black/white) I want to upgrad
-
I find it annoying that, if I have a finder window with several open tabs and I close the whole window at once, the next time I click the finder it will open up that same window with multiple tabs I don't need anymore instead of my default location.