472,328 Members | 1,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 35788
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...
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...
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...
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...
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...
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...
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,...
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...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.