• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Comma is Missing"

 
Gangadhara Thippaiah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have created a table with varchar2(30) as a column in database.
When I tried to send a value which is containing ' in it, I am
getting an error message "comma is missing". I think it is because
after ' it is considering as end of the value & expects a comma
after it.
For example, in database table I have so many columns with address
column one of them. I want to store address from frontend as
"55, 5th lane, next to Gandhi's statue, Washington", SQL ends the
value at ....gandhi & expects a comma after '.
How to overcome this problem?
Any other details required?
Gangadhara
 
Chris Klu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the SQL statement you are using.
 
Ipsita Naravane
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gangadhar, to be able to insert single quote as a part of you text, the quote must be preceded with a quote so
to insert
"55, 5th lane, next to Gandhi's statue, Washington" in your database,
try entering :
"55, 5th lane, next to Gandhi''s statue, Washington",
Shilpa
 
Gangadhara Thippaiah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shilpa, If I develop a website & user may use ' because he don't know the proble.
Then this will be a bug.
Gangadhara
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gangadhara,
That's why company's pay you the big buckaroos...As an application programmer, you need to anticipate these things and code your GUI accordingly. Don't assume smart users, rather think that you're a smart programmer. Code your text box to capture the ' and insert that into your SQL statement when you generate it.
-Peter
 
Ipsita Naravane
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
my sentiments exactly:-)
 
Gangadhara Thippaiah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris,
I am using
insert into nam values('raju','55, 5th lane, next to Gandhi's
statue, Washington');
ERROR at SQL Plus:
ORA-01756: quoted string not properly terminated
ERROR at javawebserver:
ora-00917: missing comma
Table Description(table name:nam):
Name Null? Type
------------------------------- -------- ----
NAME VARCHAR2(20)
ADDRESS VARCHAR2(100)
I think this is sufficient. Please help.
Gangadhara

 
Chris Klu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gangadhara,
Here's a solution. It's not very elegant. Java needs some regex. You reminded me I need to fix my code. I didn't antipate someone using a comma.

[This message has been edited by Chris Klu (edited January 10, 2001).]
I just realized that the method should be called apostropheReplace(). Oops.

[This message has been edited by Chris Klu (edited January 10, 2001).]
 
Gangadhara Thippaiah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to Chris, Peter & Shilpa. Stuff by Chris is really fantastic.
Gangadhara
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic