Number conversion to binary

Hello,
Oracle Info:
BANNER
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 – Production
OS Info:
Microsoft Windows XP Professional Version 2002
Service Pack 1
Is there any PL/SQL code, by which we can convert numbers to its binary representation? Numbers can be something like these:
25,2008,-25,-2008,25.23,-25.23,2008.0701,-1715.1253 etc. (any number value)
Thanks & Regards
Girish

Sir, thanks for your compliments.
There is no limit for bit selection. If the number
fits in 8 bit then result should be in 8 bit
representation otherwise more required bits would be
there.Ok, consider I show you two binary numbers...
11001101
and
1001010010
Which one is positive and which one is negative?
Without stipulating the number of bits you are working with nobody can tell. This is a key requirement of working with postitive and negative integers.
As an example bring up Micro$ofts calculator in windows and ensure you have it set to scientific mode. Enter a simple negative number in decimal e.g. -5 and then click on the Bin radio button and look at the result...
1111111111111111111111111111111111111111111111111111111111111011
This is because Microsoft have stipulated that they are using 64 bit numbers, they don't just put 1011 or 11011 or 111011; all of which could be -5 but you can't be sure.
Suppose, I have created a table having 2
columns; first column will carry number value and
another column will carry binary representation
varchar2(4000) length. I am trying for this just for
increase PL/SQL programming skills and computer
fundamentals as well.Well as you know the 2's complement of negative numbers you should easily be able to write some SQL and/or PL/SQL that can give a string representation of the binary +ve and -ve number.
You're decimal numbers will be more difficult to represent as you need to determine if you are just going to use a binary representation of the number to the left and right of the decimal point and show that as binary with a decimal point in the equivalent place or whether you are going to reserve the lower X number of bits for the number to the right of the decimal point, or are you going to represent the whole number as a binary integer and store additional information giving the position of the decimal point (i.e. how much to divide by 10 is required)
Your choice.

Similar Messages

  • FM for Material number conversion from R/3 to APO in R/3

    Hi,
       Can anybody tell me conversion exit (function module) for Material number conversion from R/3 to APO in R/3 system. I mean i have 18 digit R/3 material number which i have to convert to 40 digit APO material number in R/3 system.
    Please suggest to win full points.
    Thaniks in Advance,
    Chandan Dubey

    Dear Chandan,
    Conversion Exits:
    CONVERSION_EXIT_MATN1_INPUT ....... If you are storing Material With Zeros
    Then concatenate it with 22 zeros. i.e. '0000000000000000000000000000'.
    For example:
    data : v_matnr type matnr,            "R/3 Material
           v_apo_matnr(40) type c,        "APO Material with 40 length
           v_zeros(22) type c. value '0000000000000000000000000000'.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
           EXPORTING  INPUT          = v_matnr
           IMPORTING  OUTPUT         = v_matnr.
    concatenate e_mantr v_zeros into
                v_apo_matnr.
    Regards,
    Naveen.

  • Error ORA-06502, numeric or value error character to number conversion

    I have been trying to create an email including data from a table as part of the body. Whenever I try to send it, I get an error ORA-06502, numeric or value error, character to number conversion. If I take out the part referencing the table, the email will go without error, but if I put it back in I get the error.
    There is the code:
    DECLARE
    v_email_body CLOB;
    v_from_email_address VARCHAR2(100) := v('APP_USER');
    v_id NUMBER;
    BEGIN
    v_email_body := 'Please pay the attached invoice from FY '||:P14_FY||' funds
    Date: '||:P14_PURCHASE_DATE||'
    Vendor: '||:P14_VENDOR||'
    Invoice Number: '||:P14_INVOICE||'
    Invoice Date: '||:P14_INVOICE_DT||'
    Due Date: '||:P14_INVOICE_DUE_DT||'
    KSR Number: '||:P14_KSR||'
    DTS PO: '||:P14_DTS_PO||'
    FINANCE DO: '||:P14_FINANCE_PO||'
    FOR detail IN(SELECT OB_CODE
    FROM BUDGET_USED
    WHERE P_ID = :P14_ID)
    v_email_body := v_email_body||detail.OB_CODE||utl_tcp.crlf;
    LOOP
    FOR detail2 IN (SELECT ob_code, amount
    FROM budget_used
    WHERE p_id = :P14_ID)
    LOOP
    v_email_body := v_email_body||detail2.ELCID||' - '||detail2.AMOUNT||utl_tcp.crlf;
    END LOOP;
    END LOOP;
    v_email_body := v_email_body
    '||:P14_EMAIL_NOTES||'
    Thanks.
    v_id := APEX_MAIL.SEND
    (p_to => :P14_SUBMIT_TO
    ,p_cc => v('APP_USER')
    ,p_bcc => '[email protected]'
    ,p_from => v_from_email_address
    ,p_body => v_email_body
    ,p_subj => 'Invoice, '||:P14_VENDOR||', '||:P14_INVOICE||'');
    --Having set up your email, now add one (or more) attachments...
    FOR c1 in (SELECT FILENAME
    ,BLOB_CONTENT
    ,MIME_TYPE
    FROM file_subjects f, apex_application_files a
    where a.name = f.name
    and f.P_ID = :P14_ID) LOOP
    IF c1.blob_content IS NOT NULL THEN
    APEX_MAIL.ADD_ATTACHMENT( p_mail_id => v_id,
    p_attachment => c1.blob_content,
    p_filename => c1.filename,
    p_mime_type => c1.mime_type);
    END IF;
    END LOOP;
    END;
    Apex_mail.push_queue();
    This is important to my company to be able to put this data into an email. If anyone can help me, I would greatly appreciate it. Thank you in advance.

    Lets isolate the erroring line by running the code in debug mode and adding some debug lines at various stages in the code
    Apex has a builtin function named wwv_flow.debug which can print messages to the debug stack and would be visible when the page is run in debug mode.
    DECLARE
    v_email_body CLOB;
    v_from_email_address VARCHAR2(100) := v('APP_USER');
    v_id NUMBER;
    BEGIN
    wwv_flow.debug('BEGIN');
      v_email_body := 'Please pay the attached invoice from FY '||:P14_FY||' funds
      Date: '||:P14_PURCHASE_DATE||'
      Vendor: '||:P14_VENDOR||'
      Invoice Number: '||:P14_INVOICE||'
      Invoice Date: '||:P14_INVOICE_DT||'
      Due Date: '||:P14_INVOICE_DUE_DT||'
      KSR Number: '||:P14_KSR||'
      DTS PO: '||:P14_DTS_PO||'
      FINANCE DO: '||:P14_FINANCE_PO||'
      '||:P14_EMAIL_NOTES||'
      Thanks.
    wwv_flow.debug('Before sending mail');
      v_id := APEX_MAIL.SEND
      (p_to => :P14_SUBMIT_TO
      ,p_cc => v('APP_USER')
      ,p_bcc => '[email protected]'
      ,p_from => v_from_email_address
      ,p_body => v_email_body
      ,p_subj => 'Invoice, '||:P14_VENDOR||', '||:P14_INVOICE||'');
    wwv_flow.debug('Before attachements');
      --Having set up your email, now add one (or more) attachments...
      FOR c1 in
             (SELECT FILENAME
            ,BLOB_CONTENT
            ,MIME_TYPE
            FROM file_subjects f, apex_application_files a
            where a.name = f.name
            and f.P_ID = :P14_ID)
      LOOP
        IF c1.blob_content IS NOT NULL THEN
        APEX_MAIL.ADD_ATTACHMENT( p_mail_id => v_id,
        p_attachment => c1.blob_content,
        p_filename => c1.filename,
        p_mime_type => c1.mime_type);
        END IF;
      END LOOP;
    wwv_flow.debug('Finished attachements'); 
      Apex_mail.push_queue();
    END;What is the last message you see in the debug after running the page in debug mode and submitting it ?

  • Numeric or value error: character to number conversion error

    I'm having problems inserting a value from a date picker field (DD-MON-YYYY HH MI )
    i'm submitting this value to a packaged procedure that accepts this field as VARCHAR2 .
    on the insert, i do a to_date( P_DATE, 'DD-MON-YYYY HH:MI PM' )
    and i get the numeric conversion error.
    If I change the to_date on the procedure side, I get the :could not read the end of the format mask - which I've found threads about on this site.
    I've tried using HH24 and different formats, but I get one of the two above errors on the insert.
    If I don't fill in the datepicker field at all, it works fine.
    help is appreciated !
    Bill

    Here is the trace anyway:
    *** ACTION NAME:(application 4000, page 1) 2004-09-24 12:58:44.052
    *** MODULE NAME:(HTML DB) 2004-09-24 12:58:44.052
    *** SERVICE NAME:(TOPS) 2004-09-24 12:58:44.052
    *** SESSION ID:(151.1) 2004-09-24 12:58:44.052
    *** 2004-09-24 12:58:44.052
    ksedmp: internal or fatal error
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Current SQL statement for this session:
    declare
    rc__ number;
    begin
    owa.init_cgi_env(:n__,:nm__,:v__);
    htp.HTBUF_LEN := 255;
    null;
    null;
    null;
    null;
    f(p=>:p);
    if (wpg_docload.is_file_download) then
    rc__ := 1;
    wpg_docload.get_download_file(:doc_info);
    null;
    null;
    null;
    commit;
    else
    rc__ := 0;
    null;
    null;
    null;
    commit;
    owa.get_page(:data__,:ndata__);
    end if;
    :rc__ := rc__;
    end;
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    6A3C4A00 532 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A3C4A00 2502 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A3C4A00 2748 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A0E63C8 991 package body FLOWS_010500.WWV_FLOW_FORMS
    6A11675C 932 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
    6A11675C 247 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
    6A4B54E0 8341 package body FLOWS_010500.WWV_FLOW
    6A2A99F0 102 procedure FLOWS_010500.F
    6A2B9E54 10 anonymous block
    ----- Call Stack Trace -----
    calling call entry argument values in hex
    location type point (? means dubious value)
    ksedmp+524          CALLrel  ksedst+0 1
    ksedmptracecb+15 CALLrel _ksedmp+0            C
    _ksddoa+118          CALLreg  00000000             C
    ksdpcg+143          CALLrel  ksddoa+0
    ksdpec+180          CALLrel  ksdpcg+0 1966 6D7D208 1
    __PGOSF3__ksfpec+11 CALLrel _ksdpec+0            0
    8
    _kgerev+77           CALLreg  00000000             7474210 1966
    kgerec1+18          CALLrel  kgerev+0 7474210 6DCE5EC 1966 1
    6D7D260
    peirve+465          CALLrel  kgerec1+0
    pevmCVTCN+346 CALLrel _peirve+0           
    pfrinstrCVTCN+36 CALLrel pevmCVTCN+0 6E6E604 71CE370 7160F0C
    pfrrunno_tool+51 CALL??? 00000000
    pfrrun+1834         CALLrel  pfrrun_no_tool+0 6E6E604 6A3C010A 6E6E640
    plsqlrun+1051 CALLrel _pfrrun+0            6E6E604
    peicnt+179          CALLrel  plsql_run+0 6E6E604 1 0
    kkxexe+477          CALLrel  peicnt+0
    opiexe+4896         CALLrel  kkxexe+0 6A2B9E54
    kpoal8+1705         CALLrel  opiexe+0 49 3 6D7E06C
    _opiodr+977          CALLreg  00000000             5E 14 6D7E7CC
    _ttcpip+1827         CALLreg  00000000             5E 14 6D7E7CC 0
    _opitsk+1098         CALL???  00000000            
    opiino+938          CALLrel  opitsk+0 0 0 747ABC0 6DEFB14 D8 0
    _opiodr+977          CALLreg  00000000             3C 4 6D7FBBC
    opidrv+479          CALLrel  opiodr+0 3C 4 6D7FBBC 0
    sou2o+45            CALLrel  opidrv+0 3C 4 6D7FBBC
    opimai+237          CALLrel  sou2o+0
    OracleThreadStart@  CALLrel  opimai+0
    4+899
    77E7D338 CALLreg 00000000

  • Re: Error, numeric or value error: character to number conversion error

    Can someone please please tell me why I'm getting this error and what I'm doing wrong? It looks like a simple error, "numeric or value error: character to number conversion error".
    My code is as follows:
    string connectionString = WebConfigurationManager.ConnectionStrings["DEMO_TEST"].ConnectionString;
    OracleConnection con = new OracleConnection(connectionString);
    OracleCommand cmd = new OracleCommand("DEMO.PKG_LOCATION_TYPE.INS", con);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add(new OracleParameter("@P_DESCRIPTION", OracleDbType.Varchar2, 60));
    cmd.Parameters["@P_DESCRIPTION"].Value = "Test_Description";
    cmd.Parameters.Add(new OracleParameter("@P_NAME", OracleDbType.Varchar2, 6));
    cmd.Parameters["@P_NAME"].Value = "Test_Name";
    cmd.Parameters.Add(new OracleParameter("@P_LOCATION_TYPE_CD", OracleDbType.Decimal, 4));
    cmd.Parameters["@P_LOCATION_TYPE_CD"].Direction = ParameterDirection.InputOutput;
    con.Open();
    try
    cmd.ExecuteNonQuery();
    catch
    //In case of an error
    finally
    con.Close();
    con.Dispose();
    And I recieve the following error block:
    Oracle.DataAccess.Client.OracleException was unhandled by user code
    Message="ORA-06502: PL/SQL: numeric or value error: character to number conversion error\nORA-06512: at line 1"
    Source="Oracle Data Provider for .NET"
    DataSource="demotest"
    Number=6502
    Procedure="DEMO.PKG_LOCATION_TYPE.INS"
    StackTrace:
    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
    at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
    at System.Web.UI.WebControls.Wizard.OnFinishButtonClick(WizardNavigationEventArgs e)
    at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e)
    at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args)
    at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
    at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    ********************************************************

    Are the parameters in your procedure in the same order as they are created in this code? Oracle command works by position unless you change it to be BindByName.
    Failing that you seem to have defined a parameter (P_NAME) to have a length of 6, and are then setting it's value to a string with a length of 9.
    Also the in/output parameter is defined as type decimal. Is this correct? It is defined as InputOutput but you don't assign it any value.
    If these suggestions don't help then perhaps if you post the stored procedure you might get some more ideas.
    HTH
    Lyndon

  • PL/SQL: numeric or value error: character to number conversion error in TRG

    Hi,
    I've got strange issue with one trigger which during update of table reports (DB is 9.2.0.8):
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "UDR_LOG", line 345
    ORA-04088: error during execution of trigger 'UDR_LOG'but line 345 is:
    END IF;
    so its kind of strange
    the code looks like
    343 IF nvl(to_char(:old.PKD_ID),'''') <> nvl(to_char(:new.PKD_ID),'''') THEN
    344     v_zmn := v_zmn || 'PKD_ID''' || to_char(:old.PKD_ID) || '''' || to_char(:new.PKD_ID) || '''';
    345    END IF;
    so its concatenation not to_number usage .error is triggered by update statement on any column .
    I'm sorry I cant provide You with whole trigger code .
    So if You could only recommend any investigation method that would be great .
    Regards
    Greg

    Hi, Greg,
    When there's an error in a trigger, the line numbers in the error messages are relative to the first DECLARE or BEGIN statement; often, that's a few lines after CREATE OR REPLACE TRIGGER. Post a few lines after what you already posted.
    If you can't find the error, then create another table for testing this, and create a smaller trigger on that table, which does only enough to cause the error. Then you'll be able to post the complete trigger, and the code needed to re-create the problem.

  • ORA-06502: PL/SQL: numeric or value error: character to number conversion e

    Hi,
    when I do same thing in my procedure it throws below error but it works fine as annonymus block.
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    CREATE TABLE test_table
    (memberid NUMBER,
    trans_date date);
    DECLARE
    v_num number(10,0);
    v_text varchar2(100);
    begin
    v_text := '123456abcdef';
    v_num := substr(v_text,1,5);
    INSERT INTO test_table
    (memberid,
    trans_DATE)
    VALUES
    (v_num,
    sysdate);
    end;Thanks
    Sandhya

    Works fine as a procedure as well;
    SQL> DECLARE
      2  v_num number(10,0);
      3  v_text varchar2(100);
      4  begin
      5  v_text := '123456abcdef';
      6  v_num := substr(v_text,1,5);
      7  INSERT INTO test_table
      8  (memberid,
      9  trans_DATE)
    10  VALUES
    11  (v_num,
    12  sysdate);
    13  end;
    14 
    15  /
    PL/SQL procedure successfully completed.
    SQL> select * from test_table;
      MEMBERID TRANS_DAT
         12345 20-MAY-10
    SQL> create or replace procedure ins_test_table as
      2 
      3    v_num number(10,0);
      4  v_text varchar2(100);
      5  begin
      6  v_text := '123456abcdef';
      7  v_num := substr(v_text,1,5);
      8  INSERT INTO test_table
      9  (memberid,
    10  trans_DATE)
    11  VALUES
    12  (v_num,
    13  sysdate);
    14 
    15  end ins_test_table;
    16  /
    Procedure created.
    SQL>
    SQL> exec ins_test_table;
    PL/SQL procedure successfully completed.
    SQL> select * from test_table;
      MEMBERID TRANS_DAT
         12345 20-MAY-10
         12345 20-MAY-10

  • "Settings for material number conversion not found" occurs when ...

    After I run an initial load data into the InfoCube 0PUR_C01, I want to check the InfoCube Content by the following path:
    RSA1 -> pick up the InfoCube 0PUR_C01, right click it and select Manage -> Get to Content tab -> Click InfoCube Content button -> Deselect all selection, only tick the 1st column checkbox next to 0Material, then hit enter, get a small window titled as "Cancel" with a red STOP msg sysing "Settings for material number conversion not found" with an "Exit" button and a question mark button, click Exit button leads to SAP Easy Access screen, if clicking the question mark button, another window pops up with the msg showed above, click Technical Information button causes the original window short dump and the short dump msg shows below in between two dashed lines:
    Runtime Errors         RPERF_ILLEGAL_STATEMENT
    Date and Time          11/28/2005 14:43:13
    ShrtText
        Statement "CALL SCREEN" is not allowed in this form.
    What happened?
        Error in ABAP application program.
        The current ABAP program "SAPLSHL2" had to be terminated because on
        statements could not be executed.
        This is probably due to an error in the ABAP program.
    Error analysis
        There is probably an error in the program
        "SAPLSHL2".
        The program was probably called in a conversion exit
        or in a field exit. These are implemented by
        function modules called CONVERSION_EXIT_xxxxx_INPUT/OUTPUT or
        USER_EXIT_xxxxx_INPUT.
        Conversion exits are triggered during screen field transports or
        WRITE statements, field exits during field transports from the
        screen to the ABAP/4 program.
        In this connection, the following ABAP/4 statements are not allowed:
        -  CALL SCREEN
        -  CALL DIALOG
        -  CALL TRANSACTION
        -  SUBMIT
        -  MESSAGE W... and MESSAGE I...
        -  COMMIT WORK, ROLLBACK WORK
        -  COMMUNICATION RECEIVE
        -  STOP
        -  REJECT
        -  EXIT FROM STEP-LOOP
        Moreover, conversion exits for output conversion
        (implemented by function modules called
        CONVERSION_EXIT_xxxxx_OUTPUT) do not allow
        -  MESSAGE E...
        to be used.
    Trigger Location of Runtime Error
    Program                                 SAPLSHL2
    Include                                 LSHL2F19
    Row                                     3
    Module type                             (FORM)
    Module Name                             TECHNISCHE_INFO5
    rce Code Extract
    e  SourceCde
    1 ***INCLUDE LSHL2F19 .
    2 form technische_info5.
    >>   call screen 1900 starting at 5  8.
    4 endform.
    5
    6 &----
    7 *&      Form  SHRINK_VALUES
    8 &----
    9 *       text                                                           *
    10 ----
    11 *  -->  p1        text
    12 *  <--  p2        text
    13 ----
    14 form shrink_values.
    15
    16   loop at dynpselect.
    17     clear checktable.
    18     if dynpvaluetab-lowvalue ne space and dynpvaluetab-lowvalue na '*'.
    19       move 'EQ' to checktable-op.
    20       move dynpvaluetab-lowvalue to checktable-low_value.
    21       append checktable.
    22     endif.
    What could cause the problem by selecting only 0Material when checking the InfoCube 0PUR_C01 content?  What does that mean by this STOP msg "Settings for material number conversion not found"?
    Thanks

    Hi Kevin,
    Set the length of 0MATERIAL and change conversion to alpha:
    Re: Error Installing 0MATERIAL from Business Content
    Best regards,
    Eugene

  • ORA-06502: numeric or value error: character to number conversion error

    I met the following error when I ran Donald's PL/SQL function to_number_or_null. Could somebody here help me find the resolution? Thanks!
    SQL> create or replace FUNCTION to_number_or_null (
    2 aiv_number in varchar2 )
    3 return number is
    4 /*
    5 to_number_or_null.fun
    6 by Donald J. Bales on 12/15/2006
    7 An errorless to_number( ) method
    8 */
    9 begin
    10 return to_number(aiv_number);
    11 exception
    12 when INVALID_NUMBER then
    13 return NULL;
    14 end to_number_or_null;
    15 /
    Function created.
    SQL> select to_number_or_null('A') from dual;
    select to_number_or_null('A') from dual
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at "CAROL.TO_NUMBER_OR_NULL", line 10

    Only INVALID_NUMBER exception is handled and also VALUE_ERROR should be handeled. You can resolve it by handling VALUE_ERROR exception or by adding WHEN OTHERS as I did in following example.
    SQL> create or replace FUNCTION to_number_or_null (
      2      aiv_number in varchar2 )
      3      return number is
      4     /*
      5     to_number_or_null.fun
      6     by Donald J. Bales on 12/15/2006
      7     An errorless to_number( ) method
      8     */
      9  begin
    10     return to_number(aiv_number);
    11     exception
    12     when INVALID_NUMBER then
    13      return NULL;
    14     when OTHERS then
    15      return null;
    16     end to_number_or_null;
    17  /
    Function created.
    SQL> select to_number_or_null('A') from dual;
    TO_NUMBER_OR_NULL('A')
    ----------------------With kind regards
    Krystian Zieja

  • ORA-06502: PL/SQL: numeric or value error: character to number conversion

    Hello,
    I am new to Oracle Apex so I decided to read and do the tutorials that are on the apex.oracle.com site.
    Now I am at the tutorial 6: How to Work with Check Boxes of the Advanced Tutorials.
    At a certain point you have to add a new radio button.
    At the Item Source Value you have to add SELECT 'Y' FROM DUAL WHERE :P2_LIST_PRICE*0.75=:P2_MIN_PRICE.
    But when I try to create the item, I keep getting the following error:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Error creating item.
    Does anybody know what could be the problem.
    Thanks in advance.

    CREATE OR REPLACE PROCEDURE xxbb_query (
    p_branch_code XXBOB_HRMS_APPRAISALS_DATA.Branch_code%TYPE,
    p_PERIOD_NAME XXBOB_HRMS_APPRAISALS_DATA.PERIOD_NAME%TYPE
    IS
    emp_refcur SYS_REFCURSOR;
    v_deposits XXBOB_HRMS_APPRAISALS_DATA.deposits%TYPE :=0;
    v_branch_code XXBOB_HRMS_APPRAISALS_DATA.branch_code%TYPE:=0;
    p_query_string VARCHAR2(500);
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Hello' || ' ' || '...');
    p_query_string := 'SELECT Avg(deposits) Dep,branch_code  FROM XXBOB_HRMS_APPRAISALS_DATA WHERE ' ||
    *' Branch_code = :branch_code '||*
    *' AND PERIOD_NAME = SubStr( :PERIOD_NAME ,1,4))||(SubStr( :PERIOD_NAME ,InStr( :PERIOD_NAME ,'-',1,1)+3,5)) ' ||*
    *' group BY SubStr(PERIOD_NAME,5),BRANCH_CODE ';*
    DBMS_OUTPUT.PUT_LINE('Hi' || ' ' || '...');
    OPEN emp_refcur
    FOR p_query_string USING p_branch_code,v_p_PERIOD_NAME,v_p_PERIOD_NAME,v_p_PERIOD_NAME;
    -- DBMS_OUTPUT.PUT_LINE('----- -------');
    Here I m passing a string variable to pass the select statement for the ref cursor.
    There seems some problem in the substr conversion in the statement.
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    But when i run as a independent staement passing real values in the place of placeholders
    i get the result right.
    The *:PERIOD_NAME* format is *'Jan-2009-10'* .
    And I need to pass the *:PERIOD_NAME* to the query as *'Jan-09-10'*
    Pls suggest.
    Edited by: user7391361 on Jul 23, 2009 8:28 AM

  • Settings for material number conversion not found

    "Settings for material number conversion not found"
    This is the error that came out. I was everytime i try to access the activated business content 0material, the system comes up with this error. Please help me with this! Thank you!
    -Peter

    Hi Peter,
    try oss note 555675, it tells you to use transaction OMSL.
    regards
    Siggi
    Message was edited by: Siegfried Szameitat

  • Conversion of binary to number

    Hello,
    I have a signal conditioner controlled through serial communication with ASCII commands. Once the start command is received, there is a continuous stream of offset binary data sent and read through the serial Read Indicator. The manual informs me that I must first condition the offset binary values by subtracting 2048 from the raw values to produce a 2's complement value,  it also mentions that the data is encoded in 12 bits so negative numbers must be properly sign extended to move the data into 16 bit words used by the PC. I am not familiar with binary numbers and am unsure on where to start. If someone could provide some insight and suggestions on what my first step would be to converting the binary values into number format, that would be greatly appreciated.
    Thank you in advance,
    Jena

    That won't work because he's not receiving the string the way you think it is. The hex display is an interpretation of the underlying byte values. It is not the same as number written out in hex as a string. Your conversion assumes he's getting the character 1, followed by the character 8, followed by the character 0, followed by the character 0, followed by a space character.
    The simplest way is to use the Type Cast function, 'cause that's what it's there for. Wire in an array of the datatype you want. The thing to keep in mind is that even though the data may be fundamentally 12 bits you need to deal with multiples of 8 because a serial read will read bytes, not bits. Thus, you can convert your string to an array of I16 numbers like this:
    Message Edited by smercurio_fc on 04-08-2008 01:07 PM
    Attachments:
    Example_VI_BD2.png ‏2 KB

  • Number to a binary base number

    How can I convert a numeric data to a binary base number?
    Ex.: A into 0001010
    Thank you in advance

    OK, only conversion to a string is needed to solve the problem. (Everything else is just a cosmetic feature of the indicator where you set the formatting. This does not change the underlying data.)
    Just use "format into string" with a format code of "%07b" (=show seven binary digits and pad with zeroes to the left).
    LabVIEW Champion . Do more with less code and in less time .

  • Conversion of binary string into headecimal

    Ho will i convert binary string into hexadecimal fromat

    HI,
    Thanks but the above module is not present my system.
    I have number which needs to be converted into binary first and then into Hex.
    I have written it code for conversion of decimal number into Binary.But i am not able to convert it into Hex.
    My rough code is ....
    types : begin of t_temp,
            r1 type i,
            end of t_temp.
    data : ty_temp type standard table of t_temp ,
           wa_temp type t_temp.
    DATA : num TYPE i,
           temp1 TYPE string,
           temp2 TYPE string,
           temp3 TYPE string,
           temp4 TYPE x.
    temp1 = 0.
    temp2 = ''.
    num = 64.
    while num ne 1.
      temp1 = num MOD 2.
      num = num / 2.
      If temp1 = 1.
        num = num - 1.
      endif.
      concatenate temp1 temp2 into temp2 .
    endwhile.
      temp1 = 1.
      concatenate temp1 temp2 into temp2 .
      condense temp2 no-gaps .
      WRITE : temp2 .

  • Conversion from Binary to decimal - Need help

    Hi guys,
    I am new here and learnt some very basic Java before. I have a program that is in C++(to convert a binary number to decimal) that I found in the internet that interest me a lot. I am thinking whether this can be re-write in Java. I have tried to searh for solution but to no avail. I am wondering whether you guys can suggest a solution to this. Below are the source code in C++ :
    #include <iostream.h>
    #include <stdlib.h>
    int main()
    // part 1 : declaration
    int Bin, Dec, TempBin;
    int div;
    char valid, again;
    do {
    // part 2 : Repeat asking the value of the binary number
    Bin = TempBin = 0;
    do {
    cout << "Please input a binary number (1 to 10 bits) : ";
    cin >> Bin;
    TempBin = Bin;
    do {
    if ((TempBin % 10)==0 || (TempBin % 10)==1) // Note (1)
    valid='Y';
    else {
    cout << "Invalid pattern! use 0's and 1's only\n\n";
    valid='N';
    break;
    TempBin = (TempBin/10);
    } while (TempBin>0);
    } while (valid=='N');
    // part 3 : Convertion
    div = 1;
    Dec = 0;
    TempBin = Bin;
    do {
    Dec += (TempBin % 10)*div; // Note (2)
    div *= 2;
    TempBin = (TempBin/10);
    } while (TempBin>0);
    cout << "\nThe binary pattern " << Bin << " is equal to "
    << Dec << " in decimal pattern.\n" << endl;
    // part 4 : try another number ?
    cout << "\aTry another number (Y/N) : ";
    cin >> again;
    cout << "\n";
    } while (again=='Y' || again=='y');
    cout << "\n" << endl;
    system("PAUSE");
    return 0;
    Appreciate your help. Thank you.
    CK

    So for Java, in your example, it takes a Java
    String like "1001" and converts it to an int whose
    value is one thousand and one. Can suggest a code for
    this that takes user input str and convert to bin int.
    I read books and noticed they are various ways to do
    that. I am quite confused actually. It is like there
    is no fix way to do that, unlike C++ which is more
    easier to understand(in my opinion). Probably, because
    I knew C better than Java.
    The 'standard' way to take a String and convert it to an int...
    int TempBin=Integer.parseInt(your_string);
    You seem to be saying that you do not want to use the standard method, so you should not complain that there is no standard method. Here's some code that re-uses most of your modulo 10.
    import java.io.*;
    public class Test {
         public static void main(String []args) throws IOException {
              BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
              String result=null;
              while(true) {
                   String input=bf.readLine().trim();
                   try {
                        long v=Long.parseLong(input);
                        result=toBin(v);
                        System.out.println(result);
                   } catch(NumberFormatException e) {
                             System.out.println("Only enter 1 or 0, nothing else!");
                   System.out.println();
           public static String toBin(long btemp) {
              long temp=btemp;
              do {
                   if ((temp % 10)!=0 && (temp % 10)!=1) {
                        System.out.println("Invalid pattern! use 0's and 1's only\n\n");
                        return null;
                   temp = (temp/10);
              } while (temp>0);
              // part 3 : Convertion
              int div = 1;
              int Dec = 0;
              long TempBin = btemp;
              do {
                   Dec += (TempBin % 10)*div; // Note (2)
                   div *= 2;
                   TempBin = (TempBin/10);
              } while (TempBin>0);
              return ""+Dec;

Maybe you are looking for