Home » SQL & PL/SQL » SQL & PL/SQL » adding quotes
adding quotes [message #201139] Thu, 02 November 2006 15:01 Go to next message
miroconnect@yahoo.com
Messages: 202
Registered: April 2006
Senior Member
I have a table fg_as_events


CREATE TABLE FG_AS_EVENTS
(
EVENT_ID NUMBER(10) NOT NULL,
ALIAS VARCHAR2(200 BYTE) NOT NULL,
DISPLAY_NAME VARCHAR2(200 BYTE) NOT NULL
)


My query on this table
select * from fg_as_events where event_id='23'

My question is event_ids column is of datatype number so in the query If I pass event_id in quotes will there be any problem ? I tested the query It works but in general should I use quotes ? .
Actually I am creating sql dynamically. I have a situation where I add to a query “and conditions” based on search, here I donot know whether params passed to me are of type numbers are strings
Re: adding quotes [message #201144 is a reply to message #201139] Thu, 02 November 2006 15:44 Go to previous message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Although you passed a character string ('23'), Oracle didn't complain as it performed implicit conversion between datatypes. It will be fine as long as you don't try to pass anything but numbers. For example, '23abc' would end up with an error. For such situations, you'll have to write exception handler(s) (in PL/SQL).
Previous Topic: SQLLDR - How to import and decode my fields
Next Topic: Split comma separated string (Merged)
Goto Forum:
  


Current Time: Sun Dec 04 21:04:36 CST 2016

Total time taken to generate the page: 0.13779 seconds