Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-10
10
Medium Priority
?
996 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 1500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to recover a database from a user managed backup

705 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