473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to extract from LONG RAW data in Oracle.

HI!

I have a binary data stored in a LONG RAW column in an Oracle table. The Binary data contains .pdf document. Can anybody please help me to write a function/SP which extracts that Binary data back to pdf document or to a text file?

Any help would be highly appreciated.

Thanks in Advance!!!
Oct 3 '07 #1
9 36182
amitpatel66
2,367 Expert 2GB
HI!

I have a binary data stored in a LONG RAW column in an Oracle table. The Binary data contains .pdf document. Can anybody please help me to write a function/SP which extracts that Binary data back to pdf document or to a text file?

Any help would be highly appreciated.

Thanks in Advance!!!
Make use of RAWTOCHAR to convert the RAW data to character type
Oct 4 '07 #2
amitpatel66
2,367 Expert 2GB
Make use of RAWTOCHAR to convert the RAW data to character type
Check below functions:

Expand|Select|Wrap|Line Numbers
  1. FUNCTION chartoraw(v_char varchar2) return long raw
  2. is
  3. rawdata long raw;
  4. rawlen number;
  5. hex varchar2(32760);
  6. i number;
  7. begin
  8. rawlen := length(v_char);
  9. i := 1;
  10. while i <= rawlen
  11. loop
  12. hex := numtohex(ascii(substrb(v_char,i,1)));
  13. rawdata := rawdata || HEXTORAW(hex);
  14. i := i + 1;
  15. end loop;
  16.  
  17. return rawdata;
  18. end;
  19.  
  20.  
  21. FUNCTION rawtochar(v_raw long raw) return varchar2
  22. is
  23. rawlen number;
  24. hex varchar2(32760);
  25. rawparam varchar2(32760);
  26. i number;
  27. begin
  28. hex := rawtohex(v_raw);
  29. rawlen := length(hex);
  30. i := 1;
  31. while i <= rawlen
  32. loop
  33. rawparam := rawparam||CHR(HEXTONUM(substrb(hex,i,2)));
  34. i := i + 2;
  35. end loop;
  36.  
  37. return rawparam;
  38. end;
  39.  
  40.  
Oct 4 '07 #3
Check below functions:

Expand|Select|Wrap|Line Numbers
  1. FUNCTION chartoraw(v_char varchar2) return long raw
  2. is
  3. rawdata long raw;
  4. rawlen number;
  5. hex varchar2(32760);
  6. i number;
  7. begin
  8. rawlen := length(v_char);
  9. i := 1;
  10. while i <= rawlen
  11. loop
  12. hex := numtohex(ascii(substrb(v_char,i,1)));
  13. rawdata := rawdata || HEXTORAW(hex);
  14. i := i + 1;
  15. end loop;
  16.  
  17. return rawdata;
  18. end;
  19.  
  20.  
  21. FUNCTION rawtochar(v_raw long raw) return varchar2
  22. is
  23. rawlen number;
  24. hex varchar2(32760);
  25. rawparam varchar2(32760);
  26. i number;
  27. begin
  28. hex := rawtohex(v_raw);
  29. rawlen := length(hex);
  30. i := 1;
  31. while i <= rawlen
  32. loop
  33. rawparam := rawparam||CHR(HEXTONUM(substrb(hex,i,2)));
  34. i := i + 2;
  35. end loop;
  36.  
  37. return rawparam;
  38. end;
  39.  
  40.  
Hi!
I hope you didn't understood me correctly. Let me explain you once more, I have actually loaded the binary data (.pdf file) to an Oracle 10g database table's LONG RAW column. Now, I want to extract that LONG RAW column containing (pdf file) and write another pdf file. Then I will compare the file which is generated now and the pdf file which I have loaded to verify my load.

So, for that I need a pl/sql function-SP. If not possible via Pl/Sql you experts can provide me a Java, .Net code to extract that pdf file.

(Currently this LONG RAW column stores pdf file but later on it can store other Binary data as well)

Thanks In Advance.!!
Oct 4 '07 #4
amitpatel66
2,367 Expert 2GB
Hi!
I hope you didn't understood me correctly. Let me explain you once more, I have actually loaded the binary data (.pdf file) to an Oracle 10g database table's LONG RAW column. Now, I want to extract that LONG RAW column containing (pdf file) and write another pdf file. Then I will compare the file which is generated now and the pdf file which I have loaded to verify my load.

So, for that I need a pl/sql function-SP. If not possible via Pl/Sql you experts can provide me a Java, .Net code to extract that pdf file.

(Currently this LONG RAW column stores pdf file but later on it can store other Binary data as well)

Thanks In Advance.!!
In order to create a PDF from oracle data, you can check here

What you could do is get the binary RAW data, convert it to char, then write it to new pdf using logic as shown in the above link
Oct 4 '07 #5
In order to create a PDF from oracle data, you can check here

What you could do is get the binary RAW data, convert it to char, then write it to new pdf using logic as shown in the above link

It dosen't required to answer everytime, atleast "NOT" if you haven't understood the question correctly.

What am I asking is A and you are replying me Z...

Thanks anyways!!!
Oct 4 '07 #6
amitpatel66
2,367 Expert 2GB
It dosen't required to answer everytime, atleast "NOT" if you haven't understood the question correctly.

What am I asking is A and you are replying me Z...

Thanks anyways!!!
We are here to provide different kind of solutions to a problem or a path way so that you could proceed further. Dont expect exact solutions every time. If you feel you are not getting satisfied answer, then you can google it out your self!!
Oct 4 '07 #7
We are here to provide different kind of solutions to a problem or a path way so that you could proceed further. Dont expect exact solutions every time. If you feel you are not getting satisfied answer, then you can google it out your self!!
That's what I am doing Mr. Patel.

I am simply looking for an answer that .. How we can extract the Binary Data which is stored in LONG RAW column of a Oracle table.

Now, if you will provide me the solution that how we can change the character based data to pdf..Then after sometime I will ask you .. How to get an image file extracted from a Binary stored data.

I am not questioning you knowledge and expertise. What i said was, an humble and polite request you not to hop into to provide the opening to solution. Please try to figure out what members are trying to ask and try to provide the balanced solution..

And we member post question and reply to answers because we know that these things we cannot found over google. We post only after doing that with proper problem and expecting a proper answer (which sombody other might have faced and solved)

Thanks
Oct 4 '07 #8
debasisdas
8,127 Expert 4TB
Hi laconicamit

If you know how to use Visual Basic 6.0

Try to use AppendChunk and GetChunk method of recordset object of ADO

for storing and retriving files from LONG RAW column in Oracle.
Oct 4 '07 #9
Hi laconicamit

If you know how to use Visual Basic 6.0

Try to use AppendChunk and GetChunk method of recordset object of ADO

for storing and retriving files from LONG RAW column in Oracle.
Thanks Sir,

Let me check and get back to you..

Many Thanks.. :)
Oct 4 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: music4 | last post by:
Greetings, I need to use a long long data type integer in my program, but how to print it with printf() or an alternative? My platform is Solaris 2.7 32bit operating system, and I use Sun Forte...
5
by: dijaster | last post by:
Recently I have had the need to run loops of at least 10^10 steps. Since 32 bit integers apparently can only store values up to about 2*10^9, I have tried to use the "long long" data type. However,...
1
by: Neil West | last post by:
I’m trying to drag & drop listview items between two instances of my app. The actual data that’s passed in DoDragDrop is an arraylist that’s been serialized to a memorystream. The contents...
12
by: wenmang | last post by:
Hi, I am using following Oracle Proc-C compiler: Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006 (c) Copyright 2000 Oracle Corporation. All rights reserved. I like to...
0
by: D Kon | last post by:
Hi, I have built a VC++.NET dll function in which you pass an array of double data and 2 additional input arguments and it returns a pointer of the data address and 2 additional scallar values. ...
1
by: caine | last post by:
I want to extract web data from a news feed page http://everling.nierchi.net/mmubulletins.php. Just want to extract necessary info between open n closing tags of <title>, <categoryand <link>....
1
by: maverickx | last post by:
Hi everyone, this is about my one project, i was planning to do like this: Firstly i printed out the source code of one html page on the DOS window, and then use PERL Regular Expression to extract...
2
by: sivadhanekula | last post by:
Hi everyone, I have a problem with my Mysql data. I have 2,95,67,456 lines of data which is too much and if I run this in MYSQL front-end it is telling "OUT OF MEMORY". Any way with my collegues...
4
code green
by: code green | last post by:
I have a text field called notes in which users have typed almost anything they like. I need to find numeric data randomly inserted in there. So for example there may be a telephone number and an...
1
by: Shun | last post by:
Hello, I am trying to extract the data from my Oracle 10g database using Java. First, I tried to connect Oracle to Java using this code and it works. import java.util.*; import java.sql.*;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.