replacing single quote while loading data [message #360393] |
Thu, 20 November 2008 17:08  |
shrinika
Messages: 306 Registered: April 2008
|
Senior Member |
|
|
Hello,
I wanted to remove any single quote or double quote in the Description field while loading the data..
Here is my trigger to remove double quote. How can i remove single quote... Any help is appreciated...
create or replace trigger trg_temp_load
before insert on temp
for each row
begin
:new."Description" := translate(:new."Description",'A"','A');
end;
/
Thanks
|
|
|
|
|
|
Re: replacing single quote while loading data [message #360402 is a reply to message #360400] |
Thu, 20 November 2008 20:58   |
 |
Kevin Meade
Messages: 2103 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
No, the OP already knows how to replace things as is witnesed by their posted code that uses TRANSLATE. The problem for the OP is in knowing how to represent a single quote inside a quoted string so that it can be replaced (or removed).
But, since this is about teaching, let us offer up an alternative to translate.
1* select replace('abc''def','''',null) from dual
SQL> /
REPLAC
------
abcdef
SQL>
For this, the OP should read the docs on REPLACE.
Sorry ebrian, I didn't mean for my reply to sound rude.
Kevin
[Updated on: Thu, 20 November 2008 20:59] Report message to a moderator
|
|
|
|
|
|
|
|