Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: ODP.NET and LONG RAW

Re: ODP.NET and LONG RAW

From: Jay Wade <fish_dba_at_hotmail.com>
Date: Fri, 29 Aug 2003 08:49:27 -0800
Message-ID: <F001.005CDFF2.20030829084927@fatcity.com>


I haven't had a chance to work with this senerio much but it seems to look like it would work, have you
tried to pass the value to a stored procedure then have the stored procedure insert into the table?

I haven't had much experience with ODP but the MS Oracle Provider is really buggy with parameters.

>From: Kevin Toepke <ktoepke_at_rlcarriers.com>
>Reply-To: ORACLE-L_at_fatcity.com
>To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
>Subject: ODP.NET and LONG RAW
>Date: Fri, 29 Aug 2003 06:31:23 -0800
>
>Help!
>
>I am having trouble loading a JPEG image into Oracle via ODP.NET. I am
>getting the ORA-00932: Inconsistent datatypes error message when attempting
>to load the image into a LONG RAW column.
>
>If this wan't an Oracle Apps table, I would use a BLOB column instead of a
>LONG RAW, but my hands are tied.
>
>I have enclosed the code I am using to attempt to load the image. I know
>its
>probably something stupid, but I just can't see it in the pre-long weekend
>fog.
>
>TIA
>Kevin
>
> Private Sub loadOracle(ByVal intPersonID As Integer, _
> ByVal img As Image)
> Dim ms As New System.IO.MemoryStream()
> img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
> Dim b(ms.Length - 1) As Byte
> ms.Position = 0
> ms.Read(b, 0, ms.Length)
>
> Dim ob As New OracleBinary(b)
>
> Dim sp(2) As OracleParameter
>
> sp(0) = New OracleParameter("i_person_id", OracleDbType.Int64,
>ParameterDirection.Input)
> sp(0).Value = intPersonID
> sp(1) = New OracleParameter("i_table_name", OracleDbType.Varchar2,
>ParameterDirection.Input)
> sp(1).Value = "PER_IMAGES"
> sp(2) = New OracleParameter("i_img", ob)
> sp(2).DbType = DbType.Binary
> sp(2).Direction = ParameterDirection.Input
> sp(2).OracleDbType = OracleDbType.LongRaw
> sp(2).Size = ob.Length
> sp(2).Value = ob
>
> Dim sql As String
> sql = "INSERT INTO hr.per_images (" & _
> " image_id" & _
> " ,image" & _
> " ,parent_id" & _
> " ,table_name" & _
> ") VALUES (" & _
> " hr.per_images_s.NEXTVAL" & _
> " ,:i_img" & _
> " ,:i_person_id" & _
> " ,:i_table_name" & _
> ")"
> cOracle.runDML(sql, sp, Me.ToString)
> End Sub
>



Get MSN 8 and help protect your children with advanced parental controls. http://join.msn.com/?page=features/parental
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jay Wade
  INET: fish_dba_at_hotmail.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Aug 29 2003 - 11:49:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US