Solved

How to find number of pages in tiff images stored as Blobs in Oracle database

Posted on 2011-03-10
10
984 Views
Last Modified: 2012-06-27
I would like to know an easy method (preferable using an SQL Query) to find the number of pages stored in each record having blob data containing tiff images.  Using a middle tier or client application to do this for our large databases running into several crores of records is not viable.

Thanks in advance
0
Comment
Question by:TG_Sekhar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 4

Expert Comment

by:pinkuray
ID: 35106184
try this:

select regexp_replace(<<your COLUMN name >>, '(.)*<</Type/Pages' || chr(10) || '/Count ([[:digit:]]+).*', '\2', 1, 1, 'n') Pages from <<your table>>;

0
 

Author Comment

by:TG_Sekhar
ID: 35106307
Dear Pinkuray,

Thanks for a quick revert.  I tried and am getting the following error:

ORA-00932: inconsistent datatypes: expected NUMBER got BLOB
0
 
LVL 4

Expert Comment

by:pinkuray
ID: 35106408
ARE YOU ABLE RUN THIS:

SELECT utl_raw.cast_to_number(YOUR COLUMN)FROM YOURTABLE ;

0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 4

Expert Comment

by:pinkuray
ID: 35106427
then try this:

SELECT regexp_replace(utl_raw.cast_to_number(YOUR COL), '(.)*<</Type/Pages'
  || chr(10)
  || '/Count ([[:digit:]]+).*', '\2', 1, 1, 'n') PAGES
FROM YOURTABLE;

0
 

Author Comment

by:TG_Sekhar
ID: 35106513
When I tried
then try this:

SELECT regexp_replace(utl_raw.cast_to_number(YOUR COL), '(.)*<</Type/Pages'
  || chr(10)
  || '/Count ([[:digit:]]+).*', '\2', 1, 1, 'n') PAGES
FROM YOURTABLE;,
I am getting the following error:

ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual:57210, maximum:2000)
0
 
LVL 4

Expert Comment

by:pinkuray
ID: 35106554
it is exceeding the limits.

0
 
LVL 4

Expert Comment

by:pinkuray
ID: 35106556
is it a PDF stored in your column ?
0
 

Author Comment

by:TG_Sekhar
ID: 35106588
Blob contains TIFF images as I stated in my question.  The files are xxx.TIF files
0
 
LVL 4

Accepted Solution

by:
pinkuray earned 500 total points
ID: 35106610
yes ..

you can check this:
http://www.experts-exchange.com/Programming/Languages/Java/Q_23254555.html

this link has given from a JAVA program you can read the lines.

Once way is to use this java inside a PLSQL and get the page numbers
0
 

Author Closing Comment

by:TG_Sekhar
ID: 35163095
The solution provided is acceptable.  However for the current needs we were requiring the information quickly and hence found an alternate workaround by taking some estimated pages based on size.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup
Suggested Courses

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question