[comp.databases] Easy Oracle question

bbeckman@silver.ucs.indiana.edu (Beth Beckman) (06/13/90)

I am trying to load a row in an Oracle table using the insert command.
My question is: how do you format the command to insert a value
containing an apostrophe?  Example: Insert into tablename values
('President's Office').  Obviously, it is interpreting the apostrophe
after the 't' as the end of the field.  Thanks for your assistance!

Beth  bbeckman@silver.ucs.indiana.edu

bill@twg.UUCP (Bill Irwin) (06/13/90)

In article <47469@iuvax.cs.indiana.edu> bbeckman@silver.ucs.indiana.edu (Beth Beckman) writes:
>I am trying to load a row in an Oracle table using the insert command.
>My question is: how do you format the command to insert a value
>containing an apostrophe?  Example: Insert into tablename values
>('President's Office').  Obviously, it is interpreting the apostrophe
>after the 't' as the end of the field.  Thanks for your assistance!

Have you tried escaping the quote?
('President\'s Office')
-- 
Bill Irwin - TWG The Westrheim Group - Vancouver, BC, Canada
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
uunet!van-bc!twg!bill     (604) 431-9600 (voice) |     UNIX Systems
Bill.Irwin@twg.UUCP       (604) 431-4629 (fax)   |     Integration

srm@occrsh.ATT.COM (06/13/90)

According to the SQL*Plus Reference Guide Version 2.0, page 1-12:

INSERT INTO TABLENAME VALUES ('President''s Office');

Use 2 single quotes (or apostrophe) to represent one apostrophe in the data.

-- 
Steven R. McMaster            UNIX(R) mail:  ...!uunet!att!occrsh!srm
AT&T Network Systems
Oklahoma City Works           Any opinions expressed in the message above are
srm@occrsh.att.com            mine, and not necessarily AT&T's.

mfriedma@oracle.com (Michael Friedman) (06/13/90)

In article <176@twg.UUCP} bill@.UUCP (Bill Irwin) writes:
}In article <47469@iuvax.cs.indiana.edu} bbeckman@silver.ucs.indiana.edu (Beth Beckman) writes:
}}I am trying to load a row in an Oracle table using the insert command.
}}My question is: how do you format the command to insert a value
}}containing an apostrophe?  Example: Insert into tablename values
}}('President's Office').  Obviously, it is interpreting the apostrophe
}}after the 't' as the end of the field.  Thanks for your assistance!

}Have you tried escaping the quote?
}('President\'s Office')

This might work (I haven't checked) but I know that doubling the
apostrophe will work.

('President''s Office')

Mike Friedman, and no - I don't speak for Oracle.

--
The passing of Marxism-Leninism first from China and then from the
Soviet Union will mean its death as a living ideology ... .  For while
there may be some isolated true believers left in places like Managua,
Pyongyang, or Cambridge, MA ...   - Francis Fukuyama

bbeckman@silver.ucs.indiana.edu (Beth Beckman) (06/18/90)

>According to the SQL*Plus Reference Guide Version 2.0, page 1-12:
>INSERT INTO TABLENAME VALUES ('President''s Office');
>Use 2 single quotes (or apostrophe) to represent one apostrophe in the data.
 
Thank you to everyone who mailed and posted the answer to my question!
I have successfully inserted the value into my table.
Beth