Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Sql insert '

Options
  • 02-11-2007 4:32pm
    #1
    Registered Users Posts: 1,552 ✭✭✭


    I want to insert a name into a table which has a apostrophe but am having problems doing this with sql plus.

    I got this error

    ERROR at line 1:
    column not allowed here

    Any ideas?


Comments

  • Closed Accounts Posts: 345 ✭✭FindingNemo


    quinnd6 wrote: »
    I want to insert a name into a table which has a semi-colon but am having problems doing this with sql plus.

    I got this error

    ERROR at line 1:
    column not allowed here

    Any ideas?

    can you post your insert statement up pls ?


  • Registered Users Posts: 1,552 ✭✭✭quinnd6


    insert into table(fielda,fieldb,fieldc,date) values ("JO'SMITH","J.O'SMITH@SMITHS.ie",333, to_date('30/10/07','dd/mm/yy') );

    I also tried this beforehand
    insert into table(fielda,fieldb,fieldc,date) values ('JO'Smith' ,'J.O'Smyth.ie',333, to_date('31/01/07','dd/mm/yy') );

    and got string not properly terminated


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    quinnd6 wrote: »
    insert into table(fielda,fieldb,fieldc,date) values ("JO'SMITH","J.O'SMITH@SMITHS.ie",333, to_date('30/10/07','dd/mm/yy') );

    I also tried this beforehand
    insert into table(fielda,fieldb,fieldc,date) values ('JO'Smith' ,'J.O'Smyth.ie',333, to_date('31/01/07','dd/mm/yy') );

    and got string not properly terminated


    try this


    insert into table(fielda,fieldb,fieldc,date) values ('JO''Smith' ,'J.O'Smyth.ie',333, to_date('31/01/07','dd/mm/yy') );


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    try this


    insert into table(fielda,fieldb,fieldc,date) values ('JO''Smith' ,'J.O'Smyth.ie',333, to_date('31/01/07','dd/mm/yy') );

    sorry, just did the first column for you, this is correct.

    insert into table(fielda,fieldb,fieldc,date) values ('JO''Smith' ,'J.O''Smyth.ie',333, to_date('31/01/07','dd/mm/yy') );[/QUOTE]


  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    Or try Google - insert apostrophe oracle


  • Advertisement
  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    Are you typing this straight into the database, or through a driver for java etc.
    You could use prepared statements if you're using oracle + java.


Advertisement