Oracle -  Implict Data type converison behaviour?

Hi All,
In my Project, there are many queries have join conditions between Number column and Varhchar2 column. Will it give any wrong results or Invalid Number exception, even if the varchar2 column always contains the number data?
Example:
Select * from Table_t1 t1, table_t2 t2
where t1.num_col = t2.var_col
-- Here var_col always hold only numaric data.
Thanks

You should not depend on the implicit datatype conversion. If you allow implicit conversion then it means you donot have the control over your program. Also, it might ignore the use of Index in query. Explicit conversion not only increase the readability but also make your code clear to understand.

Similar Messages

  • 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

  • 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

  • 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.

  • How could I Write data into a field in Oracle whose data type is VARCHAR2

    The target data I want to write into Oracle is in http://tw.yahoo.com/info/utos.html.
    Now, these data is stored in Mysql database and the field which stores these data uses "Text" as its data type.
    I want to derive these data from mysql database and store them into a field of oracle database.
    In oracle, I create field whose data type is varchar2(4000) to store these data.
    I use JSP to derive data from mysql and insert into oracle through JDBC.
    But the result of the page shows me that "javax.servlet.ServletException: Data size bigger than max size for this type: 25623".
    Please anyone could help to resolve this problem?
    Thank you very much.

    My hunch is that the problem is that VARCHAR2(4000), but default, allocates 4000 bytes of storage. Depending on your database character set, a single character may require up to 4 bytes of storage.
    If you are on 9i, you can declare the column VARCHAR2(4000 CHAR) to allocate 4000 characters of storage. You can also set NLS_LENGTH_SEMANTICS to CHAR, which will cause Oracle to assume that your declarations are in characters rather than bytes.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • ORACLE Parameter Data Types

    Hi,
    We are using for all Oracle number columns the Oracle parameter type OracleType.Number.
    Now we have seen that we can also use the type OracleTyp.Int32.
    Is it better or faster to use this type for columns
    which can use this type.
    Have anybody experience with using Oracle data types ??
    Kind Regards
    Martin

    It really depends on what kind of data you're inserting or updating. If you've data that can be accomodated in an integer, you should use OracleDbType.Int32 over OracleDbType.Decimal. You get much better performance by using Byte, Int16, Int32, Single, Double over Decimal but these types can not hold the same precision and scale as Decimal type can.

  • 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

  • Oracle Object Data Type and EJB

    Hi, All:
    Has anyone implemented a project with Oracle user-defined data type (Object
    Data Type) together
    with EJB? That is, using ORDBMS (Object Relational Database) together with
    EJB. I am thinking to use ORDBMS together with EJB. Any information, samples
    and references to this direction is appreciated.
    Thanks,
    John Wen
    RM2M, LLC
    [email protected]

    I''ve got a solution! I've had sql in my query
    SELECT
      ltrim(OPERATIVE_REPORT."orderText",11),
      OPERATIVE_REPORT."resolID",
      COUNT(OPERATIVE_REPORT."(usrID)order_executionUser")
    FROM
      OPERATIVE_REPORT
    GROUP BY
      ltrim(OPERATIVE_REPORT."orderText",11),
      OPERATIVE_REPORT."resolID"
    where orderText has clob datatype. And the reason is GROUP BY. GROUP BY deny CLOB usage.

  • Oracle apps data type number came over to disco as varchar

    created custom foler ( fnd_flex_values_vl) using sql, one of DFF item ( original data type is number) shows as varchar. Anybody knows how to convert this to number , I tried to_number but still shows as text in Desktop.

    Sorry, thought you'd said it was a function originally.
    Okay, so as a custom folder, is it possible that there are NULLs being encountered in the attribute1 field?
    ie:
    select flex_value_set_id, flex_value_id,flex_value, description,
    to_char(attribute1,'999,999,999') budget,to_number(attribute1,'999,999.99') Budget_amount_number
    from fnd_flex_values_vl
    where flex_value_set_id='1004012'
    becomes:
    select flex_value_set_id, flex_value_id,flex_value, description,
    to_char(NVL(attribute1,'0'),'999,999,999') budget,to_number(NVL(attribute1,'0'),'999,999.99') Budget_amount_number
    from fnd_flex_values_vl
    where flex_value_set_id='1004012'
    or is it something more difficult?
    Russ

  • Oracle Long Data type Problem

    Hi,
    I am using ORACLE 7.3.4 database. I am having a problem in updating a column of long datatype in a table t1 with another column from table t2 of long datatype. I have tried setting LONG 1000000 also but this doesn't work. I appreciate any kind of suggestions.
    The error it gives is ORA-00997: illegal use of LONG datatype.
    Thanks
    Reddy

    I had the same problem too with a newest thin driver. I found that I can read all my characters (bytes) using getBinaryStream() and single-byte read(), but read() never returns -1; instead reading the character before last causes the ArrayOutOfBoundsException you mentioned.
    So I just blindly caught the exception and let it go to QA. (sort of
    InputStream r = rs.getBinaryStream(field);
    if(r == null) ...
    StringBuffer sb = new StringBuffer();
    try { for(int c = -1;  (c = r.read()) != -1;)  sb.append((char) c); }
    catch(IndexOutOfBoundsException e)
    {} // ignore Oracle idiosyncrazy.
    finally { r.close(); }
    ). Please note that getCharacterStream() or getAsciiStream() did not work for me. I did not try deprecated getUnicodeStream(): I decided I would better correctly extract characters in Java from binary data myself if I need them rather than allowing this junky thin Oracle driver to do an extra thing for me.

  • Can't update oracle Long data type

    Hi All,
    Setup
    Weblogic 5.1.0sp11, oracle 8.1.6, Solaris8, classes12.zip,
    Solaris_JDK_1.2.1_03a
    ConnectionPool:
    weblogic.jdbc.connectionPool.XXXDBPool=\
    url=jdbc:oracle:thin:@10.2.30.50:1521:ZZZZ,\
    driver=oracle.jdbc.driver.OracleDriver,\...etc
    Problem
    I can't seem to write to (insert/update) an oracle type Long column
    using connections from the weblogic connection pool. Each entry(as
    XML) into this column is fairly large (>1MB). Reading from works fine,
    however.
    The same configuration(minus connection pool and associated
    code/config) via tomcat works fine(read/write), so I'm thinking the
    weblogic connection pool is giving me a connection object which
    doesn't update this Long column properly.
    Using the usual(again works fine for tomcat) :-
    //Url = jdbc:weblogic:pool:XXXDBPool
    //driver = weblogic.jdbc.pool.Driver
    stat = con.prepareStatement("UPDATE BM_RM_USER_DIARY set DIARY=? where
    id=?");
    //stat.setString(1,diaryData); //use an inputstream instead.
    ByteArrayInputStream bais = new
    ByteArrayInputStream(diaryData.getBytes());
    //StringBufferInputStream bais = new
    StringBufferInputStream(diaryData); //deprecated
    stat.setAsciiStream(1, bais, bais.available());
    stat.setLong(2,userId);
    I'm not getting any errors from this update, so I can't really see
    what I might be doing wrong. It just returns fine as if it has
    succeeded (rows updated = 1)
    Assuming I CAN NOT change these settings, are there any other ways I
    can programmatically get these inserts working ? Is this even a known
    issue ? as i can't find a problem in these postings that quite matches
    mine.
    Any help appreciated.
    Cheers
    Alkesh

    Hi All
    Just to follow up on this.
    The problem was solved by explicitly calling commit() after
    the update has taken place.
    It seems as though my connection from the connection pool has
    autocommit set to false.
    Thanks
    Alkesh
    [email protected] (Alkesh) wrote in message news:<[email protected]>...
    Hi All,
    Setup
    Weblogic 5.1.0sp11, oracle 8.1.6, Solaris8, classes12.zip,
    Solaris_JDK_1.2.1_03a
    ConnectionPool:
    weblogic.jdbc.connectionPool.XXXDBPool=\
    url=jdbc:oracle:thin:@10.2.30.50:1521:ZZZZ,\
    driver=oracle.jdbc.driver.OracleDriver,\...etc
    Problem
    I can't seem to write to (insert/update) an oracle type Long column
    using connections from the weblogic connection pool. Each entry(as
    XML) into this column is fairly large (>1MB). Reading from works fine,
    however.
    The same configuration(minus connection pool and associated
    code/config) via tomcat works fine(read/write), so I'm thinking the
    weblogic connection pool is giving me a connection object which
    doesn't update this Long column properly.
    Using the usual(again works fine for tomcat) :-
    //Url = jdbc:weblogic:pool:XXXDBPool
    //driver = weblogic.jdbc.pool.Driver
    stat = con.prepareStatement("UPDATE BM_RM_USER_DIARY set DIARY=? where
    id=?");
    //stat.setString(1,diaryData); //use an inputstream instead.
    ByteArrayInputStream bais = new
    ByteArrayInputStream(diaryData.getBytes());
    //StringBufferInputStream bais = new
    StringBufferInputStream(diaryData); //deprecated
    stat.setAsciiStream(1, bais, bais.available());
    stat.setLong(2,userId);
    I'm not getting any errors from this update, so I can't really see
    what I might be doing wrong. It just returns fine as if it has
    succeeded (rows updated = 1)
    Assuming I CAN NOT change these settings, are there any other ways I
    can programmatically get these inserts working ? Is this even a known
    issue ? as i can't find a problem in these postings that quite matches
    mine.
    Any help appreciated.
    Cheers
    Alkesh

  • ORACLE CLOB data type and WIS 10901

    Hello! I have several objects in universe that has connection to ORACLE DB. One of them has type CLOB in db and Long Text in universe, other has type number and has definition COUNT(db_column).
    When I'm using this objects separate in webi query - everything fine, but when I put them together I've got error message:
    A database error occured. The database error text is: ORA-00932: inconsistent datatypes: expected - , got CLOB
    . (WIS 10901)
    What's going wrong?

    I''ve got a solution! I've had sql in my query
    SELECT
      ltrim(OPERATIVE_REPORT."orderText",11),
      OPERATIVE_REPORT."resolID",
      COUNT(OPERATIVE_REPORT."(usrID)order_executionUser")
    FROM
      OPERATIVE_REPORT
    GROUP BY
      ltrim(OPERATIVE_REPORT."orderText",11),
      OPERATIVE_REPORT."resolID"
    where orderText has clob datatype. And the reason is GROUP BY. GROUP BY deny CLOB usage.

  • Oracle XMLtype data type

    Latest Powerbuilder 12.5.2
    Oracle 11g
    How can I update a XMLType column?
    can select it, but errors on update.

    Sorry about that, I got the information from this link:
    XMLType Operations
    I guess we need to get the right syntax in sqlplus (or equivalent) then map that to PB.
    The other alternative is to create a procedure to do the update for you, pass in a clob and convert that. The 4k limit you are seeing is the limit on a varchar2. All the xml work I have done has involved endless conversions.
    CREATE OR REPLACE PROCEDURE xmlupdate (xmlin IN CLOB, xmlout OUT CLOB)
    IS
       txml           XMLTYPE;
    BEGIN
    -- Convert Clob Received into an XML document
       txml := xmltype (xmlin);
    END;

  • ASP VS Oracle data types

    Hi, someone know why when allocate a numeric value in an ASP variable with a recordset of oracle 10, return as text ? in database are numeric and is confirmed
    Thanks a lot

    This is not an ASP support forum - so you need to focus your question on the Oracle side of your problem and describe that accurately and in detail. Adding an example or sample code will assist forum members even more in trying to diagnose the issue and provide solutions.
    As for Oracle client-server - Oracle (server/db side) never sees and never deals with client-side (e.g. ASP) data types.
    The client uses an Oracle driver (OCI or JDBC) to communicate with the server. The client language provides an interface to this driver - and this interface typically deals with converting client data types into compatible Oracle server data types when making the call to Oracle. When the Oracle server receives the call from the driver, it sees Oracle data types (as passed by the driver). Thus the server will never see client data types or convert client data types to server data types.
    So the data type conversion happens in the client layer - not in the server layer.

  • Matching data types b/w oracle and sql server

    anyone here knows if there is a list of data types supported by both oracle and sql server (regardless of releases & versions?
    an immediate response would be highly appreciated.
    thanks.

    Hi,
    The following post might be of assistance to you:
    http://msdn.microsoft.com/en-us/library/ms151817.aspx
    If this is what you're looking for, then mark the question as answered and closed.
    Regards,
    Naveed.

Maybe you are looking for

  • Registering Apache 1.3.4 with OAS 407 on RedHat Linux 5.2

    Hi, Has anybody tried or succeeded in registering Apache 1.3.4 with Oracle Application Server 4.0.7 running on RedHat Linux 5.2? We're having trouble registering Apache as an External Web Listener for OAS. Applying the correction for step #2 under re

  • Parent child dim build??

    Hi, In parent child reference method can we build dimension order like child-parent-properties....? coz my source file is coming in child-parent-properties format. How I can achieve this?? Thanks

  • ADVANTAGES OF IMAP OVER POP3 IN JAVAMAIL

    Hi Everyone, Can any one explain me about the advantages of using IMAP over POP3 in JavaMail. I'll be greatly appreciate if anyone help me out. Thanks in advance, Chags

  • Active Sync error

    Hi, When i change any attribute of a user in the Authoritative Directory the Active Sync configured senses this chnage and calls the Update User Workflow and the chnages get refelcted in Identity Manager. But when the user to be updated has some capa

  • How to reduce tablesapces size due to frequently insert, update and delete?

    Dear all, Some of the tablespaces usage are almost 95%, I want to free some space for these tablesapces. As a result, I try to delete 50% data and the free space under the tablesapces are the same. Also, I try to use "ALTER TABLESPACE xxx COALESCE",