Solved

sql update statement

Posted on 2007-11-27
11
459 Views
Last Modified: 2013-12-18
I need to run this update statement

UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People's Rep'

the problem comes in with the "People's" the statement recognizes the 's as the end.

Thanks for your help.
0
Comment
Question by:rrisal
  • 2
  • 2
  • 2
  • +3
11 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 168 total points
ID: 20358540
UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People''s Rep'
0
 

Author Comment

by:rrisal
ID: 20358587
angellll thanks for the suggestion but when i run that the result i get is

Korea, Democratic People''s Rep

The desired result i was looking for was just one quotation

Korea, Democratic People''s Rep

Is there a way to do this? Thanks.
0
 
LVL 19

Assisted Solution

by:erikTsomik
erikTsomik earned 166 total points
ID: 20358599
i AGRRE WITH angelIII. The problem is apostrphies
you can also try something like this I am not sure about syntax but it is something like that
declare @str as varchar;
declare @str2 as varchar;
Set @str='Korea, Democratic People's Rep'
set @str2=replace(@str,"'", "''")
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20358625
escape character in mysql is backslash (\)

UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People\'s Rep'

angelIII is in mssql mode :)
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 34

Assisted Solution

by:johnsone
johnsone earned 166 total points
ID: 20358814
In angelIII's response, that is two single quotes, not a double quote.

Escaping a single quote will not work.  You should get a ORA-01756 with steelseth12's query.

The other way to do it is this:

UPDATE SIEBEL.EIM_ADDR_PER SET AP_COUNTRY = 'Korea, Democratic People' || chr(39) || 's Rep'
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20358860
>angelIII is in mssql mode :)
the '' (2 single quotes) will also work in Oracle...  the chr(39) "trick" is not needed, but will work also in oracle.
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 20358879
You can escape a single quote with another single quote too.
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 20358887
angelIII already explained it :-)
0
 
LVL 34

Expert Comment

by:johnsone
ID: 20359189
angelIII,

I know the chr(39) trick is not needed and the two single quotes works.  I was just giving another alternate.  I prefer your solution.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle and DateTime math 6 25
Whether to use true/false, yes/no or 0/1 11 51
mysql joining from the same table 6 32
Exchange 2010 Database wont mount 3 24
This article describes some very basic things about SQL Server filegroups.
Creating and Managing Databases with phpMyAdmin in cPanel.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now