Replace function - replacing an apostrophe
How can I use the replace function to replace an apostrophe
I am trying to do something like this
Replace(Employee."Manager Last name",''',"')
So replace the apostrophe with nothing
You may want to put the ASCII Char function for Apostrophe instead of the actual apostrophe.
Similar Messages
-
Replace Function: Replacing Whole Words Only
I'm enhancing the verity search on a project I'm working on,
removing the operator words (as well as others) from search
criteria before passing it to the verity engine. The only problem
I'm having so far is stripping out the whole words "AND", "OR", and
"NOT" from user-specified search criteria. I obviously want to do
it only in cases where "AND", "OR", and/or "NOT" are the whole
word, and not replace things like "hand", "organization", and
"notingham". It's probably so simple, but I'm a bit stumped.
While I'm here, has anyone developed anything to enhance
verity results, or know of a resource I could look into
further?you can do this with ReReplace()
look in the documentation for "boundary", somewhere in the
regex
documentation, and you'll find what you're looking for. i
think it's "\b",
so it's something along the lines of
ReReplace(str,"\b(and|or|not)\b","","all")
"ckbentdesigns" <[email protected]> wrote in
message
news:etsdqh$igj$[email protected]..
> I'm enhancing the verity search on a project I'm working
on, removing the
> operator words (as well as others) from search criteria
before passing it
> to
> the verity engine. The only problem I'm having so far is
stripping out the
> whole words "AND", "OR", and "NOT" from user-specified
search criteria. I
> obviously want to do it only in cases where "AND", "OR",
and/or "NOT" are
> the
> whole word, and not replace things like "hand",
"organization", and
> "notingham". It's probably so simple, but I'm a bit
stumped.
>
> While I'm here, has anyone developed anything to enhance
verity results,
> or
> know of a resource I could look into further?
> -
Need help in using replace function with special characters
I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
The data looks like this:
CREEK'S LANE
ie for a street named CREEK'S LANE.
I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
When I try the query below I get prompted for substitution variable value.
I don't seem to be able to find the right syntax to make this query work.
SELECT REPLACE (street_name, ''', '''')
FROM
streets WHERE street_id = 1
Does anybody know how to do this?
Any help would be much appreciated.
Thanks.
Georgegeorge91 wrote:
I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
The data looks like this:
CREEK'S LANE
ie for a street named CREEK'S LANE.
I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
When I try the query below I get prompted for substitution variable value.
I don't seem to be able to find the right syntax to make this query work.
SELECT REPLACE (street_name, ''', '''')
FROM
streets WHERE street_id = 1
Does anybody know how to do this?
Any help would be much appreciated.
Thanks.
GeorgeHa! The codes you specified rendered in the HTML, but showed properly when I listed your original posting above. I didn't understand what you meant initially because the 5-character string represenation got rendered as the quote that you said you weren't able to get - a display problem.
You're getting prompted for the substituon variable because of the ampersand; you appear to be doing this in SQL*PLUS. The first thing I would try is to SET DEFINE OFF when using the ampersands to see if that works. If That doesn't work check the docs to delmit the ampersand (I think its a backslash before it but can't remember offhand). Another, harder option might be to use the TRANSLATE function replacing the literal character instead of using REPLACE (though replacing a quote will be a little tricky). If you're on 10g also consider using the advanced quoting
Good luck!
Edited by: riedelme on May 22, 2009 12:45 PM -
Can I use Replace function in a decode??
Hello,
I am trying to use replace function inside a Decode Function,
Here is how I am doing it:
select
SUBSTR (
DECODE (
IH.DRVD_ALT_MAIL_ADDR_PRIM_FLAG,
'N',
REPLACE (
ih.subs_addr_1
|| ' '
|| ih.subs_addr_2
|| ' '
|| ih.subs_city
|| ','
|| ih.subs_state_code
|| ' '
|| ih.subs_zip_code,
'Y',
REPLACE (
IH.PRINT_ALT_MAIL_ADDR_LINE_1
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_2
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_3
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_4
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_5
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_6,
) 1,
50
address from x
Can anyone please tell me what am I doing wrong here, It always gives me an error about missing a right parenthesis.
Thanks in advance.Hi Jimmy,
Looks like you are missing the first comma in the SUBSTR function
SELECT SUBSTR (
DECODE (
ih.drvd_alt_mail_addr_prim_flag,
'N', REPLACE (
ih.subs_addr_1
|| ' '
|| ih.subs_addr_2
|| ' '
|| ih.subs_city
|| ','
|| ih.subs_state_code
|| ' '
|| ih.subs_zip_code,
'Y', REPLACE (
ih.print_alt_mail_addr_line_1
|| ' '
|| ih.print_alt_mail_addr_line_2
|| ' '
|| ih.print_alt_mail_addr_line_3
|| ' '
|| ih.print_alt_mail_addr_line_4
|| ' '
|| ih.print_alt_mail_addr_line_5
|| ' '
|| ih.print_alt_mail_addr_line_6,
), -- HERE
1,
50
address
FROM xRegards
Peter -
Replace() function doesn't work in Application Designer?
I'm using PeopleSoft Application Designer 8.51. I'm trying to do a simple Replace function so I can escape single quotes rather than allow them to blow up the sql query.
&deptid = Replace(&deptid, "'", "''");
App Designer chokes when I hit Save: "Invalid function parameter type. (2,19)"
According to the docs I'm using this correctly: http://docs.oracle.com/cd/E26239_01/pt851h3/eng/psbooks/tace/book.htm?File=tace/htm/tace14.htm#H4095
Even if I try to execute the example right out of the documentation, I get the same error: REPLACE("StringFun", "Fun", "Number");
Is this a bug in app designer? REPLACE is a super common thing, it's not something obscure. How can this not work?
Thanks in advance.I figured this out. “Replace” is a strange duck function that relies on offsets. “Substitute” is the magic I needed, works just like I was expecting Replace to work. The documentation I was reading on Replace was for “ PeopleSoft Analytic Calculation Engine” rather than peoplecode. I’ll pay closer attention to that next time. Maybe this will help someone else...
-
Replace function not working for XML CLOB data
Hi all,
I am generating XML using DBMS_XMLGEN in oracle 10g. After generating the XML, I am replacing the ROW tags with appropriate tag name using REPLACE function. Sometimes the tag name is not replaced correctly.
Eg.I am replacing </Cargo_ROW> with </CargoDetail>. But sometimes in one xml, this tag is coming as </CargoDetROW> or </CargoDetaiW>. The XML size is always huge and the same tag is repeated so many time in the loop and in the same XML, only one tag will be replaced incorrectly. This also not happening for all XMLs.
If any one knows the cause about this problem or solution, please share the same.
thanks,Yes Anton, you are right..
It was typecasting problem
replace supports clob
Check this out
SQL> declare
2 xmldata clob;
3 Begin
4 xmldata:='<Message transaction_log_id="" extraction_date="25/11/09 09:52:03 AM" versio
5 <Transaction>
6 <TransactionType>ORIGINAL</TransactionType>
7 <ControlNumber>60022449779</ControlNumber>
8 <BookingHeader>
9 <PortCodeOriginal>GBSOU</PortCodeOriginal>
10 <Contact>.</Contact>
11 <PhoneContact>.</PhoneContact>
12 </BookingHeader>
13 <PartyInformation>
14 <PartyDetails>
15 <PartyId>10002866</PartyId>
16 <Type>SHIP</Type>
17 <Name1>L LTD.</Name1>
18 </PartyDetails>
19 </PartyInformation>
20 <Cargo>
21 <CargoDetROW>
22 <CargoHeader>
23 <CargoReceivedSeqNo>600015391790</CargoReceivedSeqNo>
24 <CargoId>RW9330P013948</CargoId>
25 </CargoHeader>
26 <CargoDimensions>
27 <Length>1</Length>
28 <Width>2</Width>
29 </CargoDimensions>
30 </CargoDetail>
31 <CargoDetROW>
32 <CargoHeader>
33 <CargoReceivedSeqNo>600015391791</CargoReceivedSeqNo>
34 <CargoId>RW9330P01394AA</CargoId>
35 </CargoHeader>
36 <CargoDimensions>
37 <Length>2</Length>
38 <Width>2</Width>
39 </CargoDimensions>
40 </CargoDetail>
41 <Cargo_ROW>
42 <CargoHeader>
43 <CargoReceivedSeqNo>600015391792</CargoReceivedSeqNo>
44 <CargoId>RW9330P01322</CargoId>
45 </CargoDetaiW>
46 <CargoDimensions>
47 <Length>1</Length>
48 <Width>2</Width>
49 </CargoDimensions>
50 </Cargo_ROW>
51 </Cargo>
52 </Transaction>
53 </Message>';
54 xmldata:=to_clob(regexp_replac(xmldata,'</Cargo_ROW>|</CargoDetaiW>|</CargoDetROW>','</CargoDetail'));
55 xmldata:=to_clob(regexp_replace(xmldata,'<Cargo_ROW>|<CargoDetaiW>|<CargoDetROW>','<CargoDetail>'));
56 dbms_output.put_line(xmldata);
57 end;
58 /
<Message transaction_log_id="" extraction_date="25/11/09 09:52:03 AM"
version="1.0">
<Transaction>
<TransactionType>ORIGINAL</TransactionType>
<Contro
lNumber>60022449779</ControlNumber>
<BookingHeader>
<PortCodeOriginal>GBSOU</Por
tCodeOriginal>
<Contact>.</Contact>
<PhoneContact>.</PhoneContact>
</BookingHead
er>
<PartyInformation>
<PartyDetails>
<PartyId>10002866</PartyId>
<Type>SHIP</Ty
pe>
<Name1>L
LTD.</Name1>
</PartyDetails>
</PartyInformation>
<Cargo>
<CargoDetail>
<CargoHea
der>
<CargoReceivedSeqNo>600015391790</CargoReceivedSeqNo>
<CargoId>RW9330P01394
8</CargoId>
</CargoHeader>
<CargoDimensions>
<Length>1</Length>
<Width>2</Width>
</CargoDimensions>
</CargoDetail>
<CargoDetail>
<CargoHeader>
<CargoReceivedSeq
No>600015391791</CargoReceivedSeqNo>
<CargoId>RW9330P01394AA</CargoId>
</CargoHe
ader>
<CargoDimensions>
<Length>2</Length>
<Width>2</Width>
</CargoDimensions>
<
/CargoDetail>
<CargoDetail>
<CargoHeader>
<CargoReceivedSeqNo>600015391792</Carg
oReceivedSeqNo>
<CargoId>RW9330P01322</CargoId>
</CargoDetail>
<CargoDimensions>
<Length>1</Length>
<Width>2</Width>
</CargoDimensions>
</CargoDetail>
</Cargo>
</Transaction>
</Message>
PL/SQL procedure successfully completed.
SQL> Twinkle
Edited by: Twinkle on Nov 26, 2009 6:05 PM -
Prolem in CLOB replace function
Hi,
I am working on Oracle 10g (release 2).
Currently facing problem in replace function
My given patterns are
Replace(+string+, varchar2, clob)
Replace(+String+, clob, clob)
In both casese, I'm getting ORA-22828 error.
Can anyone please suggest the solution.
Thanks.Please see
http://asktom.oracle.com/pls/asktom/f?p=100:11:3388795154384573::::P11_QUESTION_ID:1533006062995 -
Error ORA-06502 When using function REPLACE in PL/SQL
Hi,
I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
variable var_a is of type CLOB
and the assignment statement where it gives the error is
var_a := REPLACE(var_a, '^', ''',''');
Can anyone please help!
ThanksEven then that shouldn't do so:
SQL> select overload, position, argument_name, data_type, in_out
2 from all_arguments
3 where package_name = 'STANDARD'
4 and object_name = 'LPAD'
5 order by 1,2
6 /
OVERLOAD POSITION ARGUMENT_NAME DATA_TYPE IN_OUT
1 0 VARCHAR2 OUT
1 1 STR1 VARCHAR2 IN
1 2 LEN BINARY_INTEGER IN
1 3 PAD VARCHAR2 IN
2 0 VARCHAR2 OUT
2 1 STR1 VARCHAR2 IN
2 2 LEN BINARY_INTEGER IN
3 0 CLOB OUT
3 1 STR1 CLOB IN
3 2 LEN NUMBER IN
3 3 PAD CLOB IN
4 0 CLOB OUT
4 1 STR1 CLOB IN
4 2 LEN NUMBER INI wonder what happened? -
Replacement function modules/method for obsolete Funtion Modules in ECC 6.0
We are working on Upgrade Project and need your help in finding the replacement Function module/ Methods for following obsolete Function Modules:
1. GET_FIELDTAB
2. WS_EXCEL
3. HR_DISPLAY_BASIC_LIST
4. LOG_SYSTEM_GET_RFC_DESTINATION
5. HELPSCREEN_NA_CREATE
6. TR_RELEASE_COMM
Thank in Advance.
Sarita.
Edited by: Sarita Yalamati on Mar 28, 2008 1:23 PMHi sarita,
for GET_FIELDTAB use 'DDIF_NAMETAB_GET'..here is sample code
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
TABNAME = C_STRUCTURE_NAME
WITHTEXT = ' '
TABLES
FIELDTAB = IDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
Replacement :
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
TABNAME = C_STRUCTURE_NAME
ALL_TYPES = ' '
LFIELDNAME = ' '
GROUP_NAMES = ' '
UCLEN =
IMPORTING
X030L_WA =
DTELINFO_WA =
TTYPINFO_WA =
DDOBJTYPE =
DFIES_WA =
LINES_DESCR =
TABLES
X031L_TAB =
DFIES_TAB = IDFIES
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
For WS_EXCEL use GUI_DOWNLOAD.. here is sample code
CALL FUNCTION 'WS_EXCEL'
EXPORTING
FILENAME = 'D:\FILE1.xls'
SYNCHRON = ' '
TABLES
DATA = itab
EXCEPTIONS
UNKNOWN_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Repalcement :
data : l_filename type string.
l_filename = 'D:\FILE1.xls'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = l_filename
FILETYPE = 'ASC'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = 'D:\FILE1.xls'
APPLICATION =
PARAMETER =
DEFAULT_DIRECTORY =
MAXIMIZED =
MINIMIZED =
SYNCHRONOUS =
OPERATION = 'OPEN'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
SYNCHRONOUS_FAILED = 8
NOT_SUPPORTED_BY_GUI = 9
others = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Bulk Replacements using Replace function in oracle 8i
Hi All,
Iam using oracle 8i version and i need to use Replace function for bulf replacements i mean i need to replace around 250 rows. So please anyone suggest me how to proceed
on this request as iam using oracle 8i version.
Thanks!
SriniWrite one update statement.
The where condition is the filter what rows need to be touched.
The SET condition will do the data change. For example it could use the REPLACE function if that is what it is needed.
One single update statement over 20 rows would mean the task is done in BULK. 20 single updates that each handle one row would mean it is row by row = slow by slow processing. -
SQL replace function in JDeveloper
In SQL*Plus I run the following queries...
select last_name, phone_number from employees
LAST_NAME PHONE_NUMBER
Chung 650.505.1876
Dilly 650.505.2876
Gates 916.764.6600
select last_name, replace (phone_number, '.', '-') from employees
LAST_NAME REPLACE(PHONE_NUMBER
Chung 650-505-1876
Dilly 650-505-2876
Gates 916-764-6600
If I try to use the "REPLACE" function in the JDeveloper by editing the sql statement in the view object editor and run the page the results returned for the phone number column on the page are blank.
How can I substitute a dash for the period on the page?Try using AS:
select last_name, replace (phone_number, '.', '-') AS phone_number from employees
In this case is recommended for your VO a read only query. -
Replace Function in Cold Fusion
Hello All,
The code below does the following: It finds an item in Spanish (in this case it's GetBasket.options, 2) and add `SPA` to the SKU code.
<cfif ListContains(GetBasket.options, 2)><option value="2"><cfset basketsku = GetBasket.SKU & "SPA"></option></cfif>
How do I do the following?
The SKU code is a 5 digit code for all languages. For example: the SKU code in English is 902013, but the SKU code for Spanish is 903013. As you can see the 3rd number is being replaced with 3. It will be standard for all items in Spanish. How do I modify the code above to replace the 3rd number with 3?
Thank you all very much in advance!not sure if you found an answer to this question but if you use the Replace function you can do this.
Replace(DB.value, 2, 3 ) -
Hi,
I have a database in TT Release 7.0.3.1.0 and other in Release 11.2.2.4.0. I need use replace sql function over Release 7.0.3.1.0.
I know that it not apply in this version but I've tried with ttIsqlCS in node with TT11 through connection in database TT7 but I received this error:
ttIsqlCS database_test_R7
Command> select replace('asjkhdfkhaskdh','a','1') from dual;
2818: Unknown function REPLACE
The command failed.
Command> version;
TimesTen Release 11.2.2.4.0
Any idea ??
Thanks in advance.
Babs.Hi Babs,
I am afraid that you are out of luck. SQL is implemented in the TimesTen engine/libraries not in the ttIsql client. Since 7.0 SQL does not have th REPLACE() function there is no way to execute that in 7.0 regardless of the client you use. You'll need to find some other option to accomplish what you require (maybe upgrade the 7.0 database to 11.2.2?).
Chris -
Replace function in JDeveloper 3.2
Hi JDev Team:
Are there any global replace functions in JDev 3.2, for instance I have one word, say 'aaaa', in all of my projct files, .jsp, .java, .... I like to replace with 'bbbb'.
ThanksThe JDeveloper Editor provides Search & Replace functionality for files.
What I typically do is
Select menu: Search | Search Source Path...
Enter Search String and Change Source path
and other fields and press Start
Then the Navigator displays a Search tab which lists all files with the matching string.
Double click on first file in navigator and
select menu Search | Replace
In this dialog enter your search, replace, and other options-
In the Options, If you do not want to be prompted, do not check the Prompt on replace option.
Select the Scope of Global
Selectg the Origin of Entire
When you are ready press the Multiple button to make multiple replacements.
When you are done with this file,
Press Ctrl-S to Save the file
Press Ctrl-F4 to close the window
Double click on the Next File
Press Ctrl-R to invoke the Search | Replace dialog.
You should not need to change any options.
Press Alt-M to select the Multiple Button!
While this may seem more complex then a simple Sed / Perl / Python script, it is more controllable, flexible and user friendly.
Besides, you may learn a few JDeveloper tricks.
Good Luck,
-John -
REPLACE function in PSP for formatting
Hi everyone,
<p>I am coding PL/SQL server pages at the moment and am trying to produce an onscreen report.
<br>I was just wondering if it is possible to use the REPLACE function to replace a part of a string with the same thing but in bold?
for example, I have tried:
<p>
htp.p('<TD WIDTH="43%" valign="top" align="left">'||REPLACE(var_comments,'''TEST''',||'<b>TEST</b>'||')'||'</TD>'); <p>but it isn't working. I just wanted to check it was possible and if so, where am I going wrong??
<p>
Thanks in advance!This will work:
htp.p('<TD WIDTH="43%" valign="top" align="left">'||REPLACE(var_comments,'''TEST''',||'<b>TEST</b>'||')'||'</TD>');I also suggest generating your table HTML using the htp.table... procedures.
Maybe you are looking for
-
The Ipad software update server could not be contracted. Make sure your network setting are correct and your network connection is active, or try again later. I have no problem going internet on the same PC. Itune software "check for update" also no
-
Rejected Qty reference in Purchase order
Dear Gurus I have created PO of 100 qty ,i have taken GRN of 100 qty ,in Quality rejection i have rejected 10 qty and accepeted 90 qty ========>>> Now if you will do the normal rejection i.e Return Delivery You will get the reference of this in the P
-
How to hide Ping in iTunes 10?
Whatever the heck Ping is, I know I don't need it. Is there any way to hide it from the sidebar?
-
Pages inserted image "placement" greyed
Using Pages '09, version 4.0 (727) I started with a blank document, added a table, added a photo (shift-command-V). The photo cannot be altered from "Inline (Moves with text)". Why? I had this happen a year ago, and got a solution, but I have lost my
-
Environemnt required for Installing essbase??
Hi I am Planning to Install essbase in my Organization on Linux servers and Can some one help me out with prerequisites required?? Installing essbase 9.3.1 How many servers do i need?? Do i need one seperatley for shared services and one seperately f