Solved

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

Posted on 2011-03-10
10
952 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
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
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
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
EXECUTE IMMEDIATE 5 70
Concat multi row values of a field in oracle 6 64
Get the parent node - XMLTYPE 9 73
database upgrade 8 75
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…
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 video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
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…

772 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