Solved

Insert Raw Data Into Oracle Table

Posted on 2011-09-12
3
869 Views
Last Modified: 2012-05-12
Hello,

I have a table from a 3rd party Oracle database with an ID column whose data type is RAW(16).  I am trying to insert these ID values to a new table via a VB.NET console application that uses an ODBC connection.

Basically, i'm reading the data from the source, and then creating INSERT statements for the appropriate records to the new table.  However, for the ID column, VB.NET creates the following as the SQL: "INSERT INTO TABLE1(ID) VALUES(System.Byte[]);"

What do I need to do in order to successfully insert RAW data into the new table?

Thanks,
-Torrwin
0
Comment
Question by:Torrwin
3 Comments
 
LVL 4

Expert Comment

by:vvk
ID: 36525590
oracle should take char data in hexadecimal format with 2 characters representation per byte. or if you have utl_raw package installed you can use something like utl_raw.cast_to_raw('text to convert') to make raw values
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 36525957
if you have a hex string  you can use hextoraw


for example...

insert into table1(id) values(hextoraw('11223344556677889900aabbccddeeff'));


or use a different type, like  OracleDbType.Raw
0
 
LVL 13

Author Closing Comment

by:Torrwin
ID: 36526364
Thanks, the RawToHex and HexToRaw functions were exactly what I needed.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now