Is it possible to convert ascii data in binary?

Hi all.
In my one table there is a column which contains ascii value. i want to convert it in binary. It it possible in oracle?
eg field value:1250ÿ it should be 125011111111
kindly tell how to do this.
i have tried this using a simple java program but doesnot work for some ascii values.
thank you

I created two functions :
create or replace FUNCTION dec2bin (N IN NUMBER) RETURN VARCHAR2 IS
binval VARCHAR2(64);
N2 NUMBER := N;
BEGIN
WHILE ( N2 > 0 ) LOOP
binval := MOD(N2, 2) || binval;
N2 := TRUNC( N2 / 2 );
END LOOP;
RETURN binval;
END dec2bin;
And other :
create or replace function to_ascii( inSource IN VARCHAR2 )
return varchar2 AS
ResultString varchar2(381); -- 3 * possible length of source
TempNumber number;
begin
for i in 1..length( inSource ) loop
TempNumber := dec2bin ( ascii( substr( inSource,i,1 ) ) );
ResultString := ResultString || trim( to_char(TempNumber,'00000009'));
end loop;
return ResultString;
end;
Now, in sqlplus : (just to show the binary string)
column mybin for 9999999999999999999999999999999999999999
SQL> select to_ascii('g') mybin from dual;
MYBIN
01100111
SQL> select to_ascii('girish') mybin from dual;
MYBIN
011001110110100101110010011010010111001101101000
SQL>Source:http://psoug.org/snippet/Convert-between-Decimal-Binary-Octal-and-Hex_536.htm
http://www.dbforums.com/oracle/974944-converting-string-binary.html
Is this you want or something else ?
Regards
Girish Sharma

Similar Messages

  • To Convert ASCII Data to PDF file

    Hello,
    Does any one knows how to convert ASCII data into PDF document using Java. I know there are some 3 party tools available which does this, but i don't want to use any 3 party tools.
    Can help on this matter, doing it using java programming will be appreciated

    if you don't want to use 3rd party tools, then you will need to go read either the source of an app that does it, and port/copy it.
    Or go read the the specs.

  • How to convert numeric data to binary decimal in java

    How to convert numeric data to binary decimal in java Pleas egive me code example

    There is no numeric data. It's all binary. If you're talking about Strings, look at the Integer class.

  • Is it possible to convert LabView data into OLE variant?

    Hi. I'm using Activex Data Objects (ADO) to communicate with MySQL. Some ActiveX methods give OLE variant output, with "Variant Type" like "VT_ARRAY|VT_UI1", "VT_UI1" or "VT_BSTR". With some deduction and trial and error is relatively simple to extract data from this OLE variants and convert them to LabView data types. The problem is when I try to input variant data to some ActiveX methods, it almost always give me errors, I suppose because it expects the same type of the outputs, this is: OLE variants. Now, the question is: ¿Is there any way to convert LabView data into OLE variant data? ¿How?
    I've been searching and found a lot of posts about problems when passing variant data into ActiveX, saying that sometimes SAFEARRAYs are needed, sometimes saying that there were some bugs in LV6, giving some workarounds to this bug and saying that it is fixed in LV7.1, but the supposed workarounds don't work and the bug is still present in LV7.1, if it is really a bug.
    I think that if I could put LV data into OLE variant shape I may find an answer and solution to this matter.
    Thank you
    Daniel R.
    UdeC - Chile

    Below I describe how to handle OLE Variants, but I wanted to mention that LabVIEW does have a Database Connectivity toolkit (http://sine.ni.com/nips/cds/view/p/lang/en/nid/6429) that has already created a set of VIs for ADO. You might check that out first.
    However, handling OLE Variants in LabVIEW is automatic. LabVIEW itself has a variant datatype. When you use the ActiveX property or invoke nodes and one of the parameters is an OLE Variant, it is automatically converted to a LV Variant. You can then use the LV Variant VIs (such as "Variant to Data" and "To Variant").
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • Converting ASCII to Binary

    Hello I need some help.
    I need to convert the ASCII data to Binary form. Like if i have the character 'A' and its ASCII is 65 then its binary would be 01000001.
    If there is any function/method available in java to convert ascii to binary, i would be really thanful.

    Hello I need some help.
    I need to convert the ASCII data to Binary form. Like
    if i have the character 'A' and its ASCII is 65 then
    its binary would be 01000001.
    If there is any function/method available in java to
    convert ascii to binary, i would be really thanful.
    byte ascii = 65;
    String binresult = "";
    for(int i=0;i<8;i++) {
      if(ascii%(2^i)=0) binresult += "0";
      else binresult += "1";
    }

  • Converting premitive data types into strings

    Hello everybody,
    I have a small doubt. Is it possible to convert all data types like int, boolean etc to strings. I know it is possible to convert them individually. But I would like to have it a common method to convert them all. Because I am reading the whole line, so it is taking as strings. I am unable to read their original data types, all are reading as strings.
    Can anybody tell me how to solve this problem?
    Thank you in advance,
    Kashi.

    Hi all,
    Thanx for your answers. But as I told you before I don't know the exact data type of those. Because I am reading whole file by using DataInputStream's readLine() method. It returns the whole line as String. If there are any integer or boolean etc, it converts them as strings. So I could not read the exact data type of them.
    for example:
    int a = 10;
    boolean b = true;
    String str = "The Values are" + a + b;
    this code is in one file. If I read this file from another file, the line
    String str = "The Values are" + a + b;
    reads as a string, but I couldn�t get the 'a' as ineger and 'b' as boolean. it gives they are of strings.
    Thanx,
    Kashi.

  • Converting ascii to iCal?

    I currently use Solaris CDE with Calendar details kept
    in ascii format. If I am going to use iPlanet's latest
    version of Calendar I need a way of importing all of ascii files for users into iCal. Otherwise I'm left resubmitting all details for the year.

    Hello I need some help.
    I need to convert the ASCII data to Binary form. Like
    if i have the character 'A' and its ASCII is 65 then
    its binary would be 01000001.
    If there is any function/method available in java to
    convert ascii to binary, i would be really thanful.
    byte ascii = 65;
    String binresult = "";
    for(int i=0;i<8;i++) {
      if(ascii%(2^i)=0) binresult += "0";
      else binresult += "1";
    }

  • Is BPEL supports writing character data into binary format  ?

    Hello,
    I can write a BLOB data from DB to a file using Opaque feature in File Adapter.
    But is it possible to write Character data into Binary or Hex Format either by using base64Binary or Hex or bytes formats supported in XML?
    Thanks

    I am looking WHOLE FORMA DATA in either XSTRING or BINARY FORMAT or any other format, except STRING format.
    I gave COUNTRY as an example, but am looking the HWOLE form AS IS
    Any help pls.
    Thank you   

  • Convert ASCII HttpServletRequest to UTF-8 Correctly (Possible)?

    Hi All, Is it possible to convert a request encoded in ASCII that contained UTF-8 Characters to UTF-8 correctly? I am using ATG Dynamo's Application server and for the life of me, it doesn't seem to let me encode the request in anything but ASCII. Anyone have any suggestions.
    Thanks,
    Rick

    i mean how do i get utf-8 "\ue0d0" from parsing in the string "U+e0d0"?The String object written in the form of "\u0000" has no relation with UTF-8 by itself, but the form is the Unicode escape sequence. The encoding UTF-8 is a way of transforming the String object to a byte array in a specified manner.
    If you have "U+0000" then you can replace 'U' and '+' with '\' and 'u' with a simple code, though the converted form does not work in a program. What should be done depends on what your aim is.

  • Possible corrupt or injected data

    Hello,
    I have a question for the SQL Server security experts.
    My scenario is as follows:  I am currently migrating data off a legacy system, and into another.  This system is notoriously hard to work with, and has been severely abused over the years.  Many logical associations were broken, and band aided
    back together.  It is a sunset system, however demographic data still needs to be retrieved.
    Upon loading the data into a slowly changing dimension in another system, I am running into an issue where the same values will not equal themselves.  I have tried converting the data types, stripping all non-ascii characters from the string data. 
    I have checked the data lengths, all equal similarly length and stored string data.  I am detecting no hidden characters within the string as well.  There is no reason why this data won't equal itself.  My only conclusion at this point is that
    it is either corrupted or injected.
    Are there any suggestions on how to detect possible corruption or injection?  I have read many articles around sql injection, and I suspect that I am dealing with binary data injected onto the end of the string data.  However, when I check the
    byte size it looks normal.

    Physical corruption you would detect with DBCC CHECKDB
    Corrupted foreign keys you could detect with DBCC CHECKCONSTRAINTS
    If someone has maliciously manipulated the data in order to conduct any kind of second order attack via SQL Injection or otherwise, it really depends on the skillfulness of the attack how easily one could detect & comprehend that.
    Hidden character may also have gotten into the system by badly written applications and imho are not necessarily an indication of an attack.
    Maybe you could show us a sample.
    If you truly suspect an attack going on though, you should follow your hopefully existing escalation procedures and get the system ready for a forensic investigation by making sure nothing can get changed any more. Unless you want to keep
    that system running to try to catch the attacker “live”. But I do not recommend using a production system as a honeypot if you don’t know exactly what you are doing (and probably not even then).
    Andreas Wolter (Blog |
    Twitter)
    MCSM: Microsoft Certified Solutions Master Data Platform, MCM, MVP
    www.SarpedonQualityLab.com |
    www.SQL-Server-Master-Class.com

  • Is it possible to convert *.doc to *.rtf in a java program?

    Hi :-)
    My challenge is to develop a web-app in ADF Faces. Now i verify some technologies to store mailmerge letters in an easy way. The user of my web-app should upload a MS Word mailmerge document and a csv data source file. My web-app must thereupon convert this two files to a pdf per csv-row and store it to a ftp.
    I have build a demo using the open office API. But now i want to try the same by using apache POI and FOP. I can merge the doc files with POI and i can create PDF with FOP.
    My problem is, that POI cant convert to a rtf file and FOP uses an rtf file to create a pdf. I dont know, if its possible to convert a doc file to a rtf file. If its possible, is there an API, which will help me out?
    Regards
    Majo
    btw...I am not sure, if its the right forum for my question :-/

    HeHe, no sorry. The binary file is the same, because Windows bind doc and rtf with MS Word, it opens the file, which you have renamed to *.rtf in MS Word. But as a doc document, not as a rtf file ;-)
    And i dont want to open the rtf file in MS Word. I want to process the rtf file in java.
    Thanks
    Majo

  • How to Convert Binary Data in Binary File

    hi,
    my telecom client puts a binary file which is asn.1 encoded with BER.
    how to handle binary data in java.
    how to convert binary to hexa to ascii format
    how to convert binary to octet to ascii format
    please help me in this.
    regards,
    s.mohamed asif

    You don't need to convert the data.
    Only you can do is print it in that formats, like it:
    public static String byteArrayToHex(byte[] b) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < b.length; i++)
             sb.append(Integer.toHexString(b&255) + " ");
    return sb.toString();
    take a look at this
    http://java.sun.com/docs/books/tutorial/essential/io/

  • How to convert siebel date to following format?

    Hi,
    How to convert siebel date to following format?
    01-01-2011 5:00 AM (dd-mm-yyyy hh:mm AM)
    01-JAN-2011 5:00 AM (dd-MON-yyyy hh:mm AM)
    01/01/2011 5:00 AM (dd/mm/yyyy hh:mm AM)
    Please suggest functions for conversion. Have tried few but didnt work.
    Thanks.

    Excerpts from
    http://bipconsulting.blogspot.com/2010/01/my-date-doesnt-like-me-with-siebel.html
    ".. the date data generated by Siebel with the IO is in ‘MM/DD/YYYY HH:MI:SS’ format, so it is something like ‘10/09/2008 05:31:13’. And BI Publisher doesn’t recognize that this is a date data because it’s not presented in the ‘Canonical’ format!.."
    "...There are two possible and reasonable workarounds to overcome this issue. The first one is to use one of the Siebel’s extended function ‘totext()’ to convert the Siebel date format to the ‘Canonical’ date format before the BI Publisher’s date related function comes in..."
    Please read on the above link to find out how to actually resolve this issue.
    Good Luck
    (please if this provides a solution for you grant the points and close this thread. Thanks!)
    Jorge

  • Is it possible to convert HTML to XML in as2?

    Hi,
    I am trying to develop a stock widget to use in my mobile using flashlite 2.x.
    I have chosen "http://charting.nasdaq.com" to obtain 5days chart /6months chart..
    But I am not able to use XML object for this and parse.. The values are in table format.. So I have to use LoadVars.. but writing a AS2 code
    to obtain values like High/Low price of the stock or volume is very lengthy since the data obtained are not in XML format..
    i tried this
    var example_xml:LoadVars = new LoadVars();
    example.ignoreWhite = true;
    example_xml.load("http://charting.nasdaq.com/ext/charts.dll?2-1-14-0-0-75-03NA000000www-&SF:4|5-WD=539-HT=39 5--XTBL-");
    example_xml.onLoad = function(success) {
         if (success == true) {
              trace(example_xml);
    Is it possible to convert them to xml and use relevent methods or xml properties?
    If I use example_xml:XML = new XML() then tracing example_xml (as above) doesn't give any data
    Any help?

    I had a project a few years ago where I converted 10s of thousands of TestStand HTML files from TS 1.0 and 3.0.
    Most of what I did is specific to our internal data structures, but I'll try to help get you started.
    The general idea is to pick out the report header and data sections from each file, then eliminate the HTML formatting.
    The attached file will extract the Report Header and data sections.
    To use this, you will need to download this additional VI that I posted here in the regex board a few years ago.
    http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/m-p/1269088#M14343
    Here is one more file that will parse out each data record and dtermine it's Name, status, type value, limits and duration/timestamp info
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    Parse TestStand HTML.vi ‏42 KB
    Parse TestStand HTML Data Section.vi ‏55 KB

Maybe you are looking for

  • Why does Spaces automatically switch away from my active window?

    I'm having the weirdest problem. As of a few days ago, whenever I use an app in full screen mode, this thing happens: after about ten or twenty seconds, the app will switch away from my active window, and show the desktop. What's also weird about it

  • Info for table relationship for webcenter interaction database

    Hi, Does any one know where I can get information about the table relationship for webcenter database ? I appreciate your help. Thanks Yxu

  • Problem with intersection point

    Hi! I cant use the IMAQ Line intersection with lines created from IMAQ find edge. I get the error message: "These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Context Help window to

  • Transmitting a Byte Wirelessly

    Hello, I am working on a senior project and I am using Labview 2010/2011 to control a wireless device that is controled via teh internet. WE are doing very well on it. My problem is that I cannot figure out how to transmit the data (which is only 1 b

  • Cisco Switch 2690 Si PoE-48

    Good Day guys I am given this assignment to complete the switch setup for 2960 To tell the truth, I am lost between lines of command and I cant seem to make them up and complete my assignment. no service pad service timestamps debug uptime service ti