How to insert record with comma...
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: How to insert record with comma...

  1. #1
    Join Date
    Jan 2001
    Location
    St. Louis. MO
    Posts
    150
    How do I insert a row in a table with comma using SQLPlus?
    ex.

    insert into mytable(description)
    values('Spoon,Fork');

    normally this will give ORA-01756: quoted string not properly terminated.

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095
    hmm
    Code:
    SQL> create table xyz (x varchar2(40));
    Table created.
    SQL> insert into xyz values ('abc,def');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> insert into xyz (x) values ('ghi,jkl');
    1 row created.
    SQL> commit;
    Commit complete.
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by edsperez
    How do I insert a row in a table with comma using SQLPlus?
    ex.

    insert into mytable(description)
    values('Spoon,Fork');

    normally this will give ORA-01756: quoted string not properly terminated.
    You must have mixed something up. You won't get ORA-1756 when your string contains comma - but you'll get this error if your string contains a single quote, like in

    insert into mytable(description)
    values('Spoon 'n Fork');

    in such a case you have to replace single quote with two single quotes, like in:

    insert into mytable(description)
    values('Spoon ''n Fork');
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938
    He said comma, and his example has a comma: values('Spoon,Fork'); You know the duck-saying :-)


  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by julian
    He said comma, and his example has a comma: values('Spoon,Fork');
    That's why i'm saying he must have mioxed something up. The quoted error message could not be a result of the example he provided - he probably ment a single qoute character, not a comma.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  6. #6
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095
    Does anybody think it might be related to NLS variables, by any chance?
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  7. #7
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    I sincerily doubt this could be a NLS isue. I think it would be the best if edsperez could provide us with some real example where he encounters that error - like cut & paste the SQL and the accompanying error message from SQL*Plus session.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  8. #8
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938
    I think he is not anymore interested in this thread :-)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width