A simple Question about Query ?

Status
Not open for further replies.

perk_bud

Journeyman
What is the difference between the two statements

select * from table_name where column_name(number or numeric) = '1';
select * from table_name where column_name(number or numeric) = 1;

Both return the same result so why is that only when using string we have to use apostrophe

Example : -

select * from table_name where column_name(varchar)= 'searchstring' ;

And why is that when we use numeric datafield there is no affect can any 1 explain me this Funda ?
 
Last edited:

Faun

Wahahaha~!
Staff member
perk_bud said:
What is the difference between the two statements

select * from table_name where column_name(number or numeric) = '1';
select * from table_name where column_name(number or numeric) = 1;

Both return the same result so why is that only when using string we have to use apostrophe

Example : -

select * from table_name where column_name(varchar)= 'searchstring' ;

And why when we use it numeric datafield there is no affect can any 1 explain me this Funda ?
try out a string like this

strings are fun

without quotes:D

Btw SQLPlus is smart enuf to do conversion automatically.
 
OP
P

perk_bud

Journeyman
T159 said:
try out a string like this

strings are fun

without quotes:D

Btw SQLPlus is smart enuf to do conversion automatically.

I din't get the "strings are fun" part and my question is that if the SQLPLus is smart enough to differenciate between numbers like 1 or '1' why can't it do the same for strings like where column_name= string rather than column name='string'.
 

Pathik

Google Bot
If u include spaces or special characters in ur string then u ll need the apostrophes. also it s a good programming practice.
 

Faun

Wahahaha~!
Staff member
perk_bud said:
I din't get the "strings are fun" part and my question is that if the SQLPLus is smart enough to differenciate between numbers like 1 or '1' why can't it do the same for strings like where column_name= string rather than column name='string'.

k buddy u r not getting the point,

what if i hav astring like this 2.45 islessthanbingo

Now here SQLPlus will go bonkers, thats why u always need delimiters for strings, read some book on regular expresssions.
 
Status
Not open for further replies.
Top Bottom