Thanks again for the responses.
I figured it would get to be a little involved.

I created a CFQuery that only returns data of type CHAR or NUMBER.
I'm using the Oracle Native Drivers to access an Oracle8i database.
The BLOB field is called "jpeg".
Here is the query I wrote and it responds fine.

<cfquery name="image" datasource="design_cf" dbtype="Oracle80" timeout="20">
SELECT  image_id,  DBMS_LOB.GETLENGTH(jpeg) AS jpeg_length
FROM  design.image
</cfquery>

*Note:  The DBMS_LOB.GETLENGTH(jpeg) is a function in Oracle that will return the 
number of bytes that the BLOB contains.  The return value is of type NUMBER.

When I try to actually SELECT the content of the BLOB field I get an error.
Here is the query that selects the contents of the BLOB field.
In this case the BLOB field is call "jpeg".

<cfquery name="image" datasource="design_cf" dbtype="Oracle80" timeout="20">
SELECT image_id,  DBMS_LOB.GETLENGTH(jpeg) AS jpeg_length,  jpeg
FROM  design.image
</cfquery>

And here is the error that I get:
Oracle Error Code = 932
ORA-00932: inconsistent datatypes
SQL = "SELECT image_id, DBMS_LOB.GETLENGTH(jpeg) AS jpeg_length, jpeg FROM 
design.image"
....

I believe that since the contents stored in the BLOB are not of type CHAR or NUMBER, 
the native driver is having a problem returning the content stored in the BLOB back to 
the
ColdFusion Application Server, or something like that.  I believe I'm going to have to 
somehow fool CF into thinking that the data being returned is of Type CHAR or NUMBER.  
If I do
it this way, the data may become corrupted.

Any ideas on how to get the data into a CF Variables so that I can write it to disk?

Thanks,
Troy

Dave Watts wrote:

> > I may be wrong, but I think that images are stored as binary
> > data in a BLOB. The article applies to binary data (at least
> > it seems to claim this in the first and second paragraphs)
> > regardless of its nature. It does refer to long character text
> > over and over, but I think it applies anyway. Try searching the
> > knowledge base for more articles on the "long text" setting.
>
> It mentions character text for a reason. Non-text binary data is represented
> using symbols other than ASCII characters, and CF can't handle those
> symbols. There's no easy way to work with binary data within CF,
> unfortunately, and you can't simply retrieve the binary data and push it
> directly to the browser. CF 4.5.x does provide some functions for working
> with binary data, but no way to output that binary data. You can work with
> binary data using a couple of workarounds, though; I suspect you may be able
> to retrieve it and write it to a file, then use CFCONTENT to retrieve the
> file and push that to the browser.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
>
> ------------------------------------------------------------------------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

--
Troy Simpson | North Carolina State University
NCSU Libraries | Campus Box 7111 | Raleigh | North Carolina
ph.919.515.3855 | fax.919.513.3330


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to