How to avoid oracle implicit data type conversion

Hello,
i have a query like below..
SELECT EMP_NUM
FROM EMPLOYEE
WHERE EMP_NUM=SOURCE_EMP_NUM;
1. My SOURCE_EMP_NUM data type is varchar2.
2. My table EMP_NUM data type is number.
3. In one case my SOURCE_EMP_NUM value '00000123'
4. I have an entry in table for EMP_NUM as 123.
5. In this case my query is success and giving me row for 123, which i don't want it should compare with leading zeros. But due to oracle implicit conversion the comparision getting passed.
6. I have an index for this column, so i can't use "like" operator...
Can somebody help me.....
Thanks in adv....

HI,
Just see this :---
SQL> select * from emp where deptno=00020;---------deptno is number, 00020 is number and its true
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL> select * from emp where to_char(deptno)=00020;=-------------deptno is character type and 00020 is number so still it is leaving 0000 from 20 as it number and has no impact,
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL> select * from emp where to_char(deptno)='00020';---now both are character and no row is selected.
no rows selected
So you can avoid the implicit conversion according to the requirements and in this case we are usin to_char function to avoid this.
Regards,
Navneet

Similar Messages

  • Cold Fusion Implicit Data Type Conversion

    I Have a Question for Anyone.
    I have a Simple <CFIF> Statement comparing 2 values
    Ex.(<CFIF Val1 EQ Val2>)
    Val1 is Initialize to ""
    Val2 in one of the Following 01B, 01C, 01D, 01E, 01F, 01G
    The Question I Have is:
    Why will the Comparison only crash When the value is 01F or
    01D? (Error is cannot convert to numeric value)
    All Other Work Fine.
    When I use the Compare or CompareNoCase string function
    everything is fine
    Shouldn't CF MX 7 keep it a a String value?
    Thanks
    Rob
    [email protected]

    It might be in the way you're doing the assignment, but at
    any rate, if you change your <cfif> to = <cfif
    ToString(val1) eq ToString(val2)> it should work.

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • Invalid data type conversions

    what are the invalid data type conversions in ABAP ???
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 10, 2012 6:01 PM

    No Amanda,
    The values that I see in message monitor are also those that comes to XSLT programs as input.
    I investigated our problem a little further myself:
    1) XI always converts messages into XML format - this everybody knows.
    2) In XI documentation it is declared that XI uses ISO 8601 for DATE type formatting. That's why you see dates in format YYYY-MM-DD in XML data in message monitoring.
    3) The appearance of those decimal values are not that obvious for me. If XI uses ABAP transformation for message content then applies the rules for converting ABAP data types into XML. For this there is a SAP document 'ABAP - XML mapping' from TechEd2004. This document seems to describe how ABAP data types are handled by XML transformation.
    Anyway, we currently need to play with decimal values in XSLT mapping programs inside XI:
    a) add leading 0 integer if source value < 1
    RFC returns 0.123 -> XI converts to XML '.123' -> XSLT mapper should return '0.123' ->SOAP response returns '0.123'
    b) add decimal point and trailing zeros
    RFC returns 0.000 -> XI converts to XML '0' -> XSLT mapper should return '0.000' ->SOAP response return '0.000'
    With dates, the problem is actually on documenting mapping rules when writing interface specifications. If you would write an EAI-solution-independent conversion rule (RFC/date->SOAP/char) for date field it could sound like: YYYYMMDD -> dd.mm.yyyy. This works semantically between these systems but would not work for XI-developer, because he get YYYY-MM-DD from the RFC.
    Additionally the decimal type conversion requirements in XSLT mapping programs probably only applies XI and are therefore not reusable in other EAI environments.
    I would be glad if somebody would still have further comments for this data type conversion issue.
    br: Kimmo

  • ADF View Object query to use Oracle  LONG data type

    Hi,
    I'm using a view object that uses Oracle LONG data type.The following exception is thrown
    *"java.sql.SQLException: Stream has already been closed"* and it is not fetching the correct data.
    I have searched in many forums,they suggested to use LOB instead of LONG as LONG is deprecated. But in my case I can't avoid using LONG as some of my legacy applications using the same DB.
    Please suggest me a way
    Thanks in Advance
    Felix

    Thanks for your reply Arun,
    I have solved this problem using the solution suggested by this blog [AskTom-Link|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:839298816582]
    In the above blog link,they have suggested to convert Long to Varchar by functions and asked to use this function in the column.
    Thank you all guys who have seen this post.
    Regards,
    Felix

  • Data type conversion from packed to numeric

    Hi Experts,
    i have a question on data type conversion. My requirement is:
    i have fields of type packed decimal in my internal table itab. I need to convert the values of packed decimal fields in itab to numeric type.
    Example:
    Data: begin of itab occurs 0,
                ebeln like ekko-ebeln,
                ebelp like ekpo-ebelp,
                menge(15) type p decimals 2,
                netpr(15) type p decimals 2,
              end of itab. 
    if itab-menge has a value of 2.00, i need to convert that value to '         200'.  Right justified.
    if itab-netpr has a value of 1,234.56, i need to convert that to '         123456'.
    The above internal table itab is passed to the Function module GUI_DOWNLOAD and the itab data is downloaded to a text file.
    Please let me know how to acheive this objective.

    Hi ,
    You can use
    SPLIT at '.' into v1 v2
    concatenate v1 v2 into vv1.
    REPORT ZDN_TEST_001 .
    data: lv_var1(15) type p decimals 2 value '123.00'.
    data: lv_var2(15) type p decimals 5 value '123.12121'.
    data: lv_varc1(15) type c.
    data: lv_varc2(15) type c.
    data: lv_varc1d(2) type c.
    data: lv_varc2d(5) type c.
    data: lv_varc11(15) type c.
    data: lv_varc21(15) type c.
    write:/ lv_var1.
    write:/ lv_var2.
    *1)write & REPLACE.
    write lv_var1 to lv_varc1.
    write lv_var2 to lv_varc2.
    REPLACE '.' WITH SPACE INTO lv_varc1.
                 CONDENSE lv_varc1 NO-GAPS.
    REPLACE '.' WITH SPACE INTO lv_varc2.
                 CONDENSE lv_varc2 NO-GAPS.
    write:/ lv_varc1.
    write:/ lv_varc2.
    *2)split & concatinate
    write lv_var1 to lv_varc1.
    write lv_var2 to lv_varc2.
    split lv_varc1 at '.' into lv_varc1 lv_varc1d.
    concatenate lv_varc1 lv_varc1d into lv_varc11.
    split lv_varc2 at '.' into lv_varc2 lv_varc2d.
    concatenate lv_varc2 lv_varc2d into lv_varc21.
    write:/ lv_varc11.
    write:/ lv_varc21.

  • Problem loading PostgreSQL Bytea data type to Oracle Raw data type

    We are migrating our database from PostgreSQL to Oracle. First, we convert the BYTEA data type in PostgreSQL to Oracle RAW. The BYTEA data type is variable bytes array. How can we load the BYTEA data type to Oracle RAW data type? Or I have to convert to different data type. thanks.
    Peter,

    hi,
    Instead of 'interval day to second' in method declaration use internal datatype 'DSINTERVAL_UNCONSTRAINED'.
    There are more unconstrained types in oracle.
    Bartek

  • How to embedded oracle report data in email body from forms?

    Hi,
    I am working on oracle forms and report 10g and i am new to this. I want to knw How to embedded oracle report data in email body ?
    Regards
    Shruti

    I have uploaded a sample . This might help
    http://www.alexyscorp.com/send_report_email.zip

  • The priority of different data type conversion

    Hi All,
    I want to know the priority of data type conversion rule. if in an expression, I have several kind of data type( I, P, F,N..).
    Then finaly, all the data object will convert to which data type?
    I don't know the priority of data conversion.
    E.g.   data a type i. data b type p. data c type f.
             a = b + c.
    or    data d type p, data e type f.
          if ( d > f ).
    Then who will convert to who's type?
    Thanks and Regards.
    Aaron

    For expressions, the right term in SAP is "calculation type", it's explained here : [abap help - determining the calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm]. SAP takes the "biggest" type of all variables in the expression. It can be I, P or F (smallest is I, biggest is F).
    Conditions are handled differently, just using data type conversion (see link given above by Abhishek), SAP converts from smallest to biggest type (in your case, it converts P to F and compares the two F variables).

  • How to define MDM real data type in ABAP ?

    Hi,
    I want to fetch MDM Repository data using MDM API .
    I am strugling as one field in MDM is of real type .
    Please tell me how I could define Real data type field in ABAP ?
    Thanks.
    Sandesh

    I recently had a Real type added to a repository I'm working on and noticed a dump in the API itself when trying to fetch data from that field. I'm running 5.5 so you may be experiencing a different issue. I haven't resolved the issue yet as it isn't a priority but I will most likely move to a string field and just ensure that the field has its decimal rule respected logically.

  • How to access the Custom Data type variable given in Expression edit control To and From LabVIEW

    Hello, I would like to know how to access the custom data type variable given in the Espression Edit Control from LabVIEW and vice-versa
    Say, the FileGlobals.Reference_Handle (Custom Data Type Variable) contains the
    VISA I/O session (Which in turn contains VISA_DeviceName: String, Session: Number),
    Channel1: Number and
    Channel2: Number
    I am expecting the user to give FileGlobals.Reference_Handle as the input at the ExpressionEdit Control in the edit screen of the VI Call.
    I would like to know how to get the values of this custom data type to LabVIEW?
    Say, if I have the Cluster in LabVIEW like VISA I/O session (Deive Name and Session Number), Channel1 and Channel2
    how do i need to set this cluster to the Custom Data type variable in TestStand?
    Thanks and Regards
    Prakash 

    Hi,
    TestStand to LabVIEW: i didnt understand what you r trying to achieve. But if you are using references, Use Property nodes and Invoke nodes to achieve what you want in LabVIEW.
     LabVIEW to TestStand: check the image below: You need to click the button next to 'container'. I have used a cluster output in the VI.
    Hope this helps
    .......^___________________^
    ....../ '---_BOT ____________ ]
    ...../_==O;;;;;;;;_______.:/
    Attachments:
    1.JPG ‏187 KB

  • Data type conversion JCO To ABAP( Double to DEC)

    Hi,
      I want to update a field having data type as DEC with length 11 in APO system using JCO.Whatever i give as input is not getting reflected in APO system. Instead i get some different value.
    It seems that there is some data type conversion for that field..
    Thanks
    Archana

    if(tableName.equals("BAPI10001LOCPRDVERS2"))
                                                           table.appendRow();
                                                           //System.out.println("getting inside table "+tableName);
                                                           table.setValue("SOP112","PRODUCT");
                                                           table.setValue("SCMTEST111","LOCATION");
                                                           table.setValue("1001","LOCTYPE");
                                                           table.setValue("SCMTEST111","LOCATION_INT");
                                                           table.setValue("000","PLANNING_VERSION");
                                                           table.setValue("5000","SAFETY_DAYS_SUPPLY");//this is the field having problem
                                                           table.setValue("5","SAFETY_STOCK");
                                                           table.setValue(" ","SAFTY_STOCK_CALC_METHOD");
                                                           table.setValue("5.00","OPENING_PERIOD");
                                                           table.setValue("15","FORECAST_HORIZON");
                                                           table.setValue(("20000"),"VMI_PROM_LEAD_TIME");
                                                           table.setValue("0","MINIMUM_LOT_SIZE");
                                                           table.setValue(bd1,"TARGET_DAYS_SUPPLY");

  • How can I get network data type

    how can I get network data type: ip, gatway, sub mask, and DNS on the Mac. windwos system and so go on and put cmd ipconfig / all adiquirr how can this data in mac book pro XOS.
    thanks,
    Marcello

    Select  ▹ System Preferences ▹ Network ▹ Advanced ▹ TCP/IP.

  • How to invoke functions and data type( ex. sflight structure ) that is in t

    Hi,experts,
    I create a funcion(zz_test) that return sflight table type data. I need to invoke the function in the Webdynpro for java application.
    I think I would import the funtion to local.
    But I don't know how to import the function and the data type using SAP NetWeaver Developer Studio?
    But I don't know how to invoke functions and data type( ex. sflight structure ) that is in the R/3 in the WDJ?
    Do you give me some hints?
    Thanks a lot!
    Best regards,
    tao

    Hi Wang Tao,
    For achieving this you need to user Adaptive RFC models.
    This link explains you on the same :
    http://help.sap.com/saphelp_nw70/helpdata/EN/6a/11f1f29526944e8580c5e59333d96d/frameset.htm
    Thanks
    Namrata

  • Oracle-specific data types vs Connection pool

    Hi, using Oracle-specific data types such as
    ArrayDescriptor and create it by a connection to an Oracle database from a WebSphere datasource throw a ClassCastException. There is no problem using these Oracle-specific data types when the connection is obtained via the DriverManager. WebSphere cannot fix the problem because these data types are
    not part of the JDBC specification.
    Some reply from Oracle?
    Thank you very much.

    Thank you but I there is no solution in that thread.
    Also, I know that WebLogic from BEA has a way around this issue... No Websphere work around ?
    No Oracle fixing ?
    Thanks.

Maybe you are looking for

  • Follow up transaction in CRM

    Hi All, I want to create an Order in CRM with reference to the Standard Order (which is created in ECC and replicated from ECC to CRM). When I open the Transaction (which is created in ECC and replicated from ECC to CRM). in CRM and clikc on follow u

  • How to raise application error and preserve open cursor...

    Hello, I have to raise an application error under certain circumstances. In some cases there's an open cursor that has to be read by the calling application anyway because there are data that have to be read. In other cases the cursor does not have t

  • Stop and start while loop on order

    Hallo everyone, I have this small IV, it means nothing but I want to know if it's possible to control each while loop. what I wish to do is to press the boolean button, then the while loop starts running and when i press it again the loop stops but w

  • Missing and empty Events after iPhoto 9.4 update - how to restore?

    Hi folks, I updated to iPhoto 9.4 a couple of days ago and now many of my photo 'Events' are missing, and some are now appearing as empty. Can anyone help me get my pictures back (ie restore the library to its pre-9.4 update state) -- when I used Tim

  • FCP Imported Sequence will not play audio (waveforms present)

    Hello, I've imported a sequence from FCP 7 and it relinked with little issue.  My timeline has 10 audio tracks.  Waveforms are present on all tracks.  most all the audio are .aiff files.  I can load the audio into the source player and hear the audio