Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to disable the auto-implicit data type conversion?

412284Jan 6 2004 — edited Jan 6 2004
I have a situation need to force the data-type check rather than Oracle auto-implicit data type conversion.

Can you please advise how to disable the auto-implicit data type conversion ? So that it will return error immediately when specifying wrong expression, for example:
col1/col2 while col1 and col2 are type of varchar2.

Below is the test for implicit data type conversion:

SQL> create table aa(a varchar2(5), b varchar2(5)) ;

Table created.

SQL> insert into aa values(50, 50) ;

1 row created.

SQL> select * from aa ;

A B
---------- ----------
50 50

SQL> select a/b from aa where 1=0 ;

no rows selected

SQL> select a/b from aa ;

A/B
----------
1

SQL> insert into aa values('a','b') ;

1 row created.
SQL> select a/b from aa ;
ERROR:
ORA-01722: invalid number

no rows selected

SQL> select a/b from aa where rownum=1 ;

A/B
----------
1
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 3 2004
Added on Jan 6 2004
3 comments
1,384 views