Solved

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

Posted on 2011-03-10
10
932 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
  • 6
  • 4
10 Comments
 
LVL 4

Expert Comment

by:pinkuray
Comment Utility
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
Comment Utility
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
Comment Utility
ARE YOU ABLE RUN THIS:

SELECT utl_raw.cast_to_number(YOUR COLUMN)FROM YOURTABLE ;

0
 
LVL 4

Expert Comment

by:pinkuray
Comment Utility
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
Comment Utility
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 4

Expert Comment

by:pinkuray
Comment Utility
it is exceeding the limits.

0
 
LVL 4

Expert Comment

by:pinkuray
Comment Utility
is it a PDF stored in your column ?
0
 

Author Comment

by:TG_Sekhar
Comment Utility
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
Comment Utility
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
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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 information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Via a live example, show how to take different types of Oracle backups using RMAN.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now