Data type is char but colum shud take numbers only

hi guys,
i am using forms 6i and i am developing a custom form,my problem is i have a phone no col in my form the column is of datatype varchar2 but i shu accept only numbers in that col ie like '040234545' i cud have given number in property palette but it will not take zero in front of the no . can any body help me out in this

Use following code in when-validate-item
declare
a_var varchar2(10);
begin
if trunc(a_var)=to_number(a_var) then
dbms_output.put_line('Corrent Phone');
else
dbms_output.put_line('Fractional part in Phone');
end if;
exception
when others then
dbms_output.put_line('alpha numberic Phone');
end;
You can replace a_var with name of ur text item
Regards
Gagan Goyal

Similar Messages

  • Why have to append spaces when data type is char?

    I have a tabe MyTable which has tow columns(code char(8),name varchar2(16)) and there is one record ('003','mike') in the table,I retrieve the table use the code :
    ......//get database connection
    String sql = "SELECT * FROM MyTable where code = ?";
    PreparedStatement st = conn.prepareStatement(sql);
    st.setString(1,"003");
    ResultSet rs = st.executeQuery();
    ......//other code
    I cann't retrieve the record,I have to append 5 space to the parameter to get data: st.setString(1,"003 ").
    When column's data type is char , I have to append spaces to the parameter values? why?

    or if you want to do it at the API level, you can use the Oracle extension
    OraclePreparedStatement.setFixedCHAR
    public void setFixedCHAR(int paramIndex,
                             java.lang.String x)
                      throws java.sql.SQLException
        Use this method when binding to a CHAR column in the
    where clause of a Select statement. A non padded
    comparision will be done unlike in setCHAR and setString
    case. Not particularly needed for an insert as the
    database will pad it.
    Parameters:
    paramIndex - index of the bind variablex - the literal/variable to be bound.like..,
    String sql = "SELECT * FROM MyTable where code = ?";
    PreparedStatement st = conn.prepareStatement(sql);
    ((oracle.jdbc.OraclePreparedStatement)st).setFixedCHAR(1, "003");
    pstmt.executeQuery();Regards
    Elango.

  • How to Change Date-Type to Char-Type with Format?, When it.....

    I'd like to Change format Data from Date-Type Column to char-type
    especially, as 'YYYYMMDD' Format, But There are some Error Message.
    I already know, to_char(sysdate, 'yyyymmdd') from dual,
    But When it Applied my Table (has Date Type Column )....
    That SQL was Error...
    Table Description
    ===================
    GUBUN     NOT NULL     NUMBER(7)
    POLCD     NOT NULL     NUMBER(7)
    TITLE          VARCHAR2(200)
    VALUE          NUMBER(7)
    SIDATE          VARCHAR2(20)
    SQL
    ================================
    SELECT TO_CHAR(SIDATE,'YYYYMMDD') as V_SIDATE , -- <== Error
    TO_CHAR(SYSDATE,'YYYYMMDD') as V_TODAY -- <== Ok
    FROM T_POLL
    Error Msg
    ================================
    ORA-01722: invalid number
    .....I don't know Why... plz. help me, it's Urgent...-_-;
    ICQ : 40751557
    MSN : [email protected]
    Finally, sorry for my poor English...

    The reason for the error is you are applying a TO_CHAR function to a character datatype. SIDATE is a character. That field should be a date field. If for some reason, you need it to stay as a character field then you will need to change it to a date then change it back to a character.
    TO_CHAR(TO_DATE(SIDATE,'put format here'),'YYYYMMDD')

  • Why the objects of sysman are created with the data type varchar2 CHAR

    Hi,
    I have an environment with the following properties,
    NLS_LENGTH_SEMANTICS BYTE
    NLS_CHARACTERSET AL32UTF8
    After I have created the db control repository, I find the data type of the sysman's objects are
    VARCHAR2 (64 CHAR)
    Why?

    NLS_LENGTH_SEMANTICS does not apply to tables in SYS and SYSTEM. The data dictionary always uses byte semantics.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams127.htm

  • I reloaded my old iWorks 08 to my iMac's new hard drive. With a new Pages document, I can't see the cursor. You can type in text but it is in white only. Any thoughts?

    Hi. I lost my iMac's hard drive and had a new one installed. I reloaded my old iWorks 08 software and then transferred my Pages documents from a portable HD to the iMac. The files open but the original text in them (they are journals) are in white against the white background. Plus I can't see any sign of the cursor. I can hi-lite the text and change its colour but never to black. Plus the photos I inserted along side the text are barely visible, as if they had been badly faded.
    Any thoughts on this? Many thanks.
    Richard

    Richard,
    You must run Software Update and bring your old iWorks 08 to the latest release for compatibility with the current OS.
    Jerry

  • Problem with converting data types

    Hi Experts,
    I am stuck up with a little problem, i need your help
    i am converting all the data types to CHAR but i am not getting the expected data out.........
    My code is as below...where do i go wrong...
    LOOP AT <T_ITAB> ASSIGNING <FIELD>.
    DO.
       ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FIELD> TO <RECORD>.
       IF SY-SUBRC = 0.
          LV_FIELD = <RECORD>.
          N = STRLEN( LV_FIELD ).
          IF N = '8'.
               IF LV_FIELD IS NOT INITIAL.
                      LV_DATE = LV_FIELD.
                      CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
                              EXPORTING
                              DATE                     = LV_DATE
                             EXCEPTIONS
                                    PLAUSIBILITY_CHECK_FAILED = 1
                                    OTHERS                     = 2.
                             IF SY-SUBRC <> 0.
                                     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                             ENDIF.
                         IF SY-SUBRC EQ 0.
                            CONCATENATE LV_FIELD+6(2) LV_FIELD+4(2) LV_FIELD+0(4) INTO LV_FIELD SEPARATED BY '.'.
                        ENDIF.
                ENDIF.
             ENDIF.
                IF LV_RECORD IS INITIAL.
                         LV_RECORD = LV_FIELD.
                ELSE.
                       CONCATENATE LV_RECORD LV_FIELD INTO LV_RECORD SEPARATED BY '  * '.
               ENDIF.
           ELSE.
         EXIT." DO
        ENDIF.
       ENDDO.
      APPEND LV_RECORD TO LT_OUTPUT.
    CLEAR LV_RECORD.
    ENDLOOP.
    THE TABLE LT_OUTPUT     LIKE     THENV(CHAR 255)
    My output looks some thing like this:
    04  36876   15.09.2011  39600   1999
    06  36960   15.09.2011  39600   2632
    07  36874   15.09.2011  39541   9232
    My expected output
    04    36.876  15.09.2011    39.600  1.999
    06    36.960  15.09.2011    39.600  2.632
    07    36.874  15.09.2011    39.541  9.232
    Regards
    sam

    At run time you can see all the data........ like what i have shown...
    but if you clearly see, DATE will be in the internal format..but if you print it, it will be in dd:mm:yyyy
    can you suggest me if i have a dynamic field symbol (table data) ,,,, How can i convert data types dynamically..
    if it is a static internal table i am achieving with WRITE TO statement.....but i have huge data in field symbols...
    Instead of all these , please specify the exact problem your are facing . What is it with date field ? . In SAP while printing the internal format will be converted to external. What is your requirement with this date field?
    My output looks some thing like this:
    04 36876 15.09.2011 39600 1999
    06 36960 15.09.2011 39600 2632
    07 36874 15.09.2011 39541 9232
    My expected output
    04 36.876 15.09.2011 39.600 1.999
    06 36.960 15.09.2011 39.600 2.632
    07 36.874 15.09.2011 39.541 9.232
    I dont see any problems mentioned in your date field. Both your actual and expected outputs reflects the same in date field.
    In SCN you will only get solutions if your question is precise.
    Kesav

  • Does CHAR data type work with Forms 11g

    We have an application in Forms 11g (32bit - version 11.1.2.0.0). DB is a Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production.
    When our Forms calls a stored procedure which has parameters defined using column name type (i.e. like p_customer_code customers.code%TYPE ) and if the column data type is CHAR we get a run time error when executing the package (ORA-06502: PL/SQL: numeric or value error string).
    When we change the data type of the tables column to varchar2, it works??
    Problem is we have dozens of tables with CHAR data type columns and we can't do all the changes manually. For one thing, if they are part of a primary or unique key or even foreign key, we can't change the data type of the column without dropping the constraint.
    What is the solution to this pls??

    When our Forms calls a stored procedure which has parameters defined using column name type (i.e. like p_customer_code customers.code%TYPE ) and if the column data type is CHAR we get a run time error when executing the package (ORA-06502: PL/SQL: numeric or value error string).this might also be related to compile settings, check your NLS settings (NLS_LANG, NLS_LENGTH_SEMANTICS) both times when you compile forms AND your stored procedures.
    As for the CHAR datatype: CHAR internally is treated like a blank padded varchar:
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1542606219593
    Speaking of that it might be time to use varchar2 instead your char columns. You'd have to drop and recreate your constraints, but with the help of the data dictionary (+user_tables+, user_tab_cols, user_cons_columns, user_constraints) and dbms_metadata this shouldn't be that hard.
    Also you'd of course need to recompile all your forms after you are finished, but I guess you are aware of that ;)
    cheers

  • Info Object: Change of Data Type (NUMC to CHAR)

    We have a scenario wherein one of the Info objects is defined currently as NUMC. Due to the change in the Source system, the info object is now defined with data type as CHAR. The info object in consideration is the "Cost element".
    As the current info object contains data, it will not be possible to change the data type from NUM to CHAR.
    Is there any pre-defined way of doing this data type change without loss of data (in the info object as well as the info cube(s) where the info object is used)?
    Regards
    Bala

    Hi Balakrishana,
       Try this:
    Insted of changing the definition of infoobject(NUMC to CHAR), why cant you change the data itself from CHAR to NUMC...?? If length is same.
       You can write a simple routine in transfer rules and you can convert.
    Hope it Helps
    Srini

  • Unicode Program : # is appearing for data types declared as char type

    Hi friends,
    I have copied one program on unicode system to unicode system. As only char type data types are allowed, i converted structure EP to char type only. Now during execution it is giving dump because it is showing value as '#' for 2 fields whos original data type was P and currency. How shall i convert them? Any suggession will helpful.
    Abhijit

    Hi Sandeep,
    This is my piece of code : Initially structure EP was used in read dataset which is of different datatypes. so i created similar structure ep_c with data type as char. As u suggested, i  tried to declare field BETRG as type currency. Then also it gave dump. (Runtime errors: UC_OBJECTS_NOT_CHARLIKE). For 2 fields BETRG and POHRS which is of currency and dec type originally, i am getting values as '#' causing in dump. In non unicode program both fields have values as '0.00' If i put these values in debugging then after execution, program comes to selection screen! Kindly advise.
    Data : komok(2) type c,
           betrg(18) TYPE c,
             betrg type betrg,
             pohrs(10) type c.
    open dataset seq-in for input in text mode encoding default ignoring conversion errors.
          if sy-subrc = 0.
            do.
              read dataset seq-in into ep_c.
              case sy-subrc.
                when 0.
                  move :ep_c-id to ep-id,
                        ep_c-text to ep-text,
                        ep_c-abkrs to ep-abkrs,

  • Unicode Migration using National Characterset data types - Best Practice ?

    I know that Oracle discourages the use of the national characterset and national characterset data types(NCHAR, NVARCHAR) but that is the route my company has decide to take and I would like to know what is the best practice regarding this specifically in relation to stored procedures.
    The database schema is being converted by changing all CHAR, VARCHAR and CLOB data types to NCHAR, NVARCHAR and NCLOB data types respectively and I would appreciate any suggestions regarding the changes that need to be made to stored procedures and if there are any hard and fast rules that need to be followed.
    Specific questions that I have are :
    1. Do CHAR and VARCHAR parameters need to be changed to NCHAR and NVARCHAR types ?
    2. Do CHAR and VARCHAR variables need to be changed to NCHAR and NVARCHAR types ?
    3. Do string literals need to be prefixed with 'N' in all cases ? e.g.
    in variable assignments - v_module_name := N'ABCD'
    in variable comparisons - IF v_sp_access_mode = N'DL'
    in calls to other procedures passing string parameters - proc_xyz(v_module_name, N'String Parameter')
    in database column comparisons - WHERE COLUMN_XYZ = N'ABCD'
    If anybody has been through a similar exercise, please share your experience and point out any additional changes that may be required in other areas.
    Database details are as follows and the application is written in COBOL and this is also being changed to be Unicode compliant:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    NLS_CHARACTERSET = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET = AL16UTF16

    ##1. while doing a test convertion I discovered that VARCHAR paramaters need to be changed to NVARCHAR2 and not VARCHAR2, same for VARCHAR variables.
    VARCHAR columns/parameters/variables should not by used as Oracle reserves the right to change their semantics in the future. You should use VARCHAR2/NVARCHAR2.
    ##3. Not sure I understand, are you saying that unicode columns(NVARCHAR2, NCHAR) in the database will only be able to store character strings made up from WE8MSWIN1252 characters ?
    No, I meant literals. You cannot include non-WE8MSWIN1252 characters into a literal. Actually, you can include them under certain conditions but they will be transformed to an escaped form. See also the UNISTR function.
    ## Reason given for going down this route is that our application works with SQL Server and Oracle and this was the best option
    ## to keep the code/schemas consistent between the two databases
    First, you have to keep two sets of scripts anyway because syntax of DDL is different between SQL Server and Oracle. There is therefore little benefit of just keeping the data type names the same while so many things need to be different. If I designed your system, I would use a DB-agnostic object repository and a script generator to produce either SQL Server or Oracle scripts with the appropriate data types or at least I would use some placeholder syntax to replace placeholders with appropriate data types per target system in the application installer.
    ## I don't know if it is possible to create a database in SQL Server with a Unicode characterset/collation like you can in Oracle, that would have been the better option.
    I am not an SQL Server expert but I think VARCHAR data types are restricted to Windows ANSI code pages and those do not include Unicode.
    -- Sergiusz

  • Issue with Info Object Transport after changing Data Type

    Hi Experts,
    We have a DSO which is running past 5 years. And recently(3 days back) we added new fields into that DSO. Delta loaded for last three days and new info object (Say XXX) data populated into DSO.
    Now the problem is, We identified that, info object data type is not correct. We used data type NUMC  instead of CHAR.So Character information is missing for that field.
    Example:
    Data from ECC: ABC123
    Data Loaded to DSO: 123 (Missed character ABC)
    So we deleted data from DSO and changed the info object data type in Development system.
    And also I have deleted only last three days delta records from DSO and transported my info object to Production. But its giving error as: Info object contains data in DSO".
    But that info object field is empty in DSO. I have already deleted last three days delta.
    Do I need to Delete all 5 years data from DSO to change the data type of recently added new info object ?
    Please give me your solutions and ideas to solve this issue.
    Thank you,
    Best Regards,
    Santhosh

    Hi Raman,
    Thank you for your answer.
    When I changed the data type of info object in Dev, I deleted the content of DSO. And same thing transported to QA as well. Before importing changed info object, I just deleted the content of DSO from QA. So transport done successfully QA.
    But in Production we have a history of past 5 years. So I cant delete all contents of DSO.
    So just deleted only the delta request's which contains data for that info object(3 days back, we moved that info object(NUMC data type) to production,So last 3 days delta only loaded for that info object). And tried to transport it. But it was failed. I am sure we need to drop all data from DSO, if I am interested to go with same info object.
    I have some comments on your first approach,
    1. If we delete info objects from Dev DSO and transport to Production will give transport failure, Why because, my previous transports errors clearly saying that info object contains data in DSO . So it wont allow to remove that info object from DSO.
    2.We are using same info object technical name in BO Data federator also. So if we change add new info objects again we need to make changes with BO as well. I am thinking this point as my last option if i cant find any other solution.
    Thank you.
    Best Regards.

  • Data Type of a Infoobject

    Hi Experts
    I am getting values from source system in the format of 22,22.3,30.5,1.3,99.99
    As per my requirment i need to have a Selection variable in my report so that user can choose Show me all records which are > 30 and <35.5
    So to meet my requirments what data type of char should i have to create CHAR or NUMC
    Please advice
    Thanks

    Hi...
    NUMC - Numeric String  - It can store only digits (0 to 9).
    It cannot store any other characters like ( "." Dot etc)
    So in this case you have to use CHAR only.
    But generally numbers has to be stored in Key figure info Objects instead of characteristics.
    Hope  u got it.
    cheers.

  • How to add new data type

    I need to add new data type like SDO_GEOMETRY in spatial Oracle.
    I don't mean the User-Defined Datatype but new datatype imbed in the database.
    It might be written in C++ or Java but I do not know how.
    Any hints and help will be appreciated. Thanks,

    > It is not simply defining new VARCHAR3.
    I will compare embedded new built-in data type and UDT as part of my research.
    What I really meant was what do you want from your new type that a user-defined object can't give you? (Apart from the obvious shortcomings of Oracle object types being addressed, but that could take a while.) You specifically said "I don't mean the User-Defined Datatype but new datatype imbedded in the database" and I wondered what you meant by that.

  • Why is there a data type NUMC?

    Hi ABAP masters,
    working in database support for several years I've very often seen the problems that arise from the awkward data type NUMC.
    A numeric type stored as characters.
    What I always wondered is: what is this data type really good for?
    The leading zero output display alone is hardly a valid reason to waste storage and complicate the usage of the data of that type.
    I cannot imagine any use for this data type that wouldn't be better done by using integer types.
    So, if you know what the reasoning behind this data type is, please let me know.
    thanks and best regards,
    Lars

    NUMC data type can be used to maintain positive numbers with leading Zeros
    Most of SAP's important numbers like Sales Order numbers, Customer numbers, Delivery documents,
    Material numbers, Sales Org, Division, Company Codes, Distribution Channel are CHARs only
    But if their Data is containing only digits, SAP Transactions will automatically add Leading zeros for them and store in the database as Raw data.
    If those SAP numbers contains at least one non-digit character, then leading zeros will not be added.
    Example: if 54 is assigned to BUKRS it will be stored in DB as 0054
                   if 5A is assigned to BUKRS it will be stored in DB as 5A only
    Leading zero concept is very useful for Date and Time calculations.
    Month, Day, hours etc., must be declared as NUMC for better calculations
    Example:
        PARAMETERS p_year TYPE I.          "instead of Integer we can use type N LENGTH 4 also here
        DATA  v_month TYPE N LENGTH 2.
        DATA  v_day     TYPE N LENGTH 2.
        DATA  v_year    TYPE N LENGTH 4.       then calculations will be easy
        DATA  FDATE   TYPE D.
        v_year = p_year.
        v_day  = 1.              "1st day of Month
        DO 12 TIMES.
            v_month = sy-index.           "Leading zero will be added automatically
            CONCATENATE v_year  v_month  v_day  INTO  FDATE.
            WRITE / FDATE.                "Every month 1st day of selected year
        ENDDO. 
    Example:  Customer number contains uneven digits.  It should be converted to a 10 digit number
                     with "C" as 1st Character.  Logic will be
                     PARAMETERS custno TYPE I.               
                     DATA  v1                     TYPE  N  LENGTH  10.
                     DATA  str_custno         TYPE C LENGTH 11.
                     v1 = custno.       "customer number will be converted to 10 digit number
                     CONCATENATE 'C'  V1   INTO  str_custno.
    please correct me, if I am wrong
    Thanks and Regards
    Nagababu Tubati

  • RF Screen Field-Data Type

    Hi,
       Please let me know if the Data Type- STRG (Char string,variable length) is allowed for RF Screen.
    I want to use a field with Defined Len = 1000 CHAR & visible Len = 1.
    Pls let me know if you hv some other solution also...
    Regards,
    Rushikesh

    I'm not familiar with module pool programs and their impossibilities ??
    but I guess the transfer of data or retrieving of data is the same whether youi have a selection screen or not.
    in the selection screen all data is gathered in a range. you can also create and fill a range you're self
    look at datatype ranges for more info
    example
    ranges: h_arbid for crhd-objid occurs 0 .
    you can now define
    h_arbid-option = 'I'.
    h_arbid-sign = 'BT'.   "means between or EQ for single value
    h_arbid-low = 'start 1'.
    h_arbid-high = 'start 10'.
    append h_arbid.
    you can also add more ranges to the same selection.
    h_arbid-option = 'I'.
    h_arbid-sign = 'BT'.   "means between or EQ for single value
    h_arbid-low = 'start 20'.
    h_arbid-high = 'start 30'.
    if you pass it on to you're select statement it is
    select * from table where arbid IN h_arbid.
    so you get all the records from 1 till 10 and 20 till 30
    kind regards
    arthur

Maybe you are looking for