Home » SQL & PL/SQL » SQL & PL/SQL » quoted string not properly terminated...
quoted string not properly terminated... [message #245232] Fri, 15 June 2007 10:48 Go to next message
mbalves
Messages: 20
Registered: May 2007
Junior Member
Hello,

I want to insert the follow string in a field:
I'm a good guy

How can i do it?

I can not do something like:
upadate table1 set f1 = 'I'm a good guy';
because the char ' is the same of the delimited string. One way is to do in this way:

upadate table1 set f1 = 'I' || chr(39) || 'm a good guy';

But i want to know if there are any special character to indicate that the follow character belong to string

Best, Miguel

Re: quoted string not properly terminated... [message #245234 is a reply to message #245232] Fri, 15 June 2007 10:51 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Double the single quote to escape it :

update table1 set f1 = 'I''m a good guy';


Thomas

[Updated on: Fri, 15 June 2007 10:52]

Report message to a moderator

Re: quoted string not properly terminated... [message #245298 is a reply to message #245232] Fri, 15 June 2007 14:53 Go to previous messageGo to next message
SnippetyJoe
Messages: 63
Registered: March 2007
Location: Toronto, Canada
Member
In some versions you can also do it this way.

select q'[I'm a good guy ]' from dual ;

Q'[I'MAGOODGUY]
---------------
I'm a good guy

1 row selected.


--
Joe Fuda
SQL Snippets
Re: quoted string not properly terminated... [message #245307 is a reply to message #245298] Fri, 15 June 2007 15:43 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This works too:
SQL> select 'we are good guys' from dual;
'WEAREGOODGUYS'
----------------
we are good guys

1 row selected.

Maybe it is a little bit OT. ./fa/1598/0/

Regards
Michel going to ./fa/1774/0/
Previous Topic: no data found
Next Topic: Cursors
Goto Forum:
  


Current Time: Sat Dec 03 16:07:55 CST 2016

Total time taken to generate the page: 0.09858 seconds