Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 788875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:26:08+00:00 2026-05-14T21:26:08+00:00

Here is the thing. I have an array of 0 and 1. It is

  • 0

Here is the thing. I have an array of 0 and 1. It is supposed to be a binary string. What i need is to format it to string that contains base36 conversion from that binary.
In other words, i need to do this: array of 1 and 0 -> some kind of binary number -> convert to base36 number -> put it into string.
How to do that?

Thousands of oil, 300 steel and +1 luck to answerers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:26:08+00:00Added an answer on May 14, 2026 at 9:26 pm

    There is no Oracle built-in to do this sort of conversion. In the following example I use two functions witten by the inestimable Mr Kyte. to_dec() turns other bases to decimals, and to_base() turns decimals into other bases.

    The procedure takes an array of ones and zeroes and returns a string of base 36.

    create or replace type binary_nt as table of number(1,0);
    /
    
    create or replace function base2_to_base36 
        (p_onesnzeroes in binary_nt)
        return varchar2
    is
        s_b2 varchar2(38);
        n_b10 pls_integer;
        s_b36 varchar2(38);
    begin
        for i in 1..p_onesnzeroes.count()
        loop
            s_b2 := s_b2||trim(to_char(p_onesnzeroes(i)));
        end loop;
    
        n_b10 := to_dec(s_b2, 2);
        s_b36 := to_base(n_b10, 36);
    
        return s_b36;
    end;
    /
    

    The proof of the pudding and all that …

    SQL> set serveroutput on size unlimited
    SQL>     declare
      2          bins binary_nt := binary_nt(1,0,0,0,1,1,1,0);
      3          s varchar2(128);
      4      begin
      5          --  10001110 => 142  => 3Y
      6          s :=  base2_to_base36(bins);
      7          dbms_output.put_line(s);
      8      end;
      9      /
    3Y
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    edit

    While I was assembling this sample you posted that your array of zeroes was ~450 entries long. This routine won’t handle anything like that. It will hurl ORA-01426: numeric overflow way before you hit a number of that size.

    edit 2

    If you are happy to gamble with a little imprecision, you could replace the NUMBER variables with BINARY_DOUBLE variables (in both my sample and Tom’s functions). That datatype can handle much bigger numbers. I cranked it up to array_count=470, which might look like this in base 36 :

    EKQA1EJ6QB4SC8WOOWKWGGOS4KWWWWCS4WCW4SCWCOSOOS888K4CSC8SWO8OCKC8SSCWCOGK844CKG00SOW8KGS0CC4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is an example bit from the xml file: <array> <dict> <key>Name</key> <string>Joe Smith</string>
I have this code that is supposed to take an array with some words,
Here is the thing. I currently have a tabBar controller, with several navigation controllers
Here's the thing. I have an interface, and I would to put the Include
Here is the thing. Right now I have this e-commerce web site where people
I have some doubt on wget command. Here is the thing I want to
I have a problem with docking. Here is the thing. I hope I can
CSS newbie here. Strange thing is happening, I have gaps between links, and I
I have this curious thinf happening here where tempArray is supposed to be added
Ok, so I have a simple c++ program that's supposed to run a couple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.