?
Solved

Insert Raw Data Into Oracle Table

Posted on 2011-09-12
3
Medium Priority
?
953 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 74

Accepted Solution

by:
sdstuber earned 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

719 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