Can I pass a number for varchar2 to Oracle?

I have an Oracle table, and column ( col1) is of type varchar2(12 byte). It has one line and the value col1is1234

When I speak

select * from table where col1 = 1234

Oracle specifies an invalid number. Why is this? Why can't I pass a number when it is varchar2?

EDIT: All answers are great. Thank. But I cannot understand why it does not accept 1234when it 1234is a valid varchar2 data type.

+5
source share
3 answers

, , Oracle 1234 . , Oracle . , Oracle . Oracle , , . , , , :

Oracle .

+5

, char, :

select *
from table
where col1 = to_char(1234)

col1 , to_number , .

+4

Oracle . ? , varchar2?

Oracle col1 , .

, 1234 - , . Oracle , where. col1, , 1234 , .

. abc canot ,


, col1, , ,

+3
source

All Articles