Replace function help
Hi all, sry for post sql problens in APEX forum, but i realy need help for this...
I´m trying to replace : for , to make a select where in () with more then one value... but the replace function its not work with more then 1 value...
like this
select name from vw_requerente where id_cliente in REPLACE(:P5000_CLIENTE,':',',')in that item has this value: 71:72:73 , but all i get is a ORA: INVALID NUMBER, how can i make a replace function to work with this?
tnks alot and sry my english.
He also posted this in the pl/sql forum and received some good advice there:
replace function help
Especially the tom kyte blog portion:
[http://tkyte.blogspot.com/2006/06/varying-in-lists.html]
Thank you,
Tony Miller
Webster, TX
Similar Messages
-
Regular Expression / replace Function Help
The problem:
cfset myString = "i am a big boy"
cfset outputString = replace("i am a big
boy","i","you","all")
Wrong Output:
you am a byoug boy
Intended Output
you am a big boy
How do I achive that output.Your first example had only one sentence. That's why I gave
that answer.
Anyway for your real question, you need to use regular
expressions
#rereplace(myString,"i\s","you ","all")# - will give u
you am a big boy you am a big boy you am a big boy you am a
big boy.
\s looks for a whitespace character after the letter i. So
that way it will not change the letter i in big -
Efficient regex replace function? Help!
Here's what I'm trying to do:
Scan through a string, and replace any occurences of http://...... (until the next space) with an HTML link. Does anyone know what would be the most efficient regex replace function to do this?
Thank you very much in advance.class StringReplaceDemo{
public static void main (String args[]){
String mystr = "This is hyperlink to Google http:// . From there you can search for any thing in the world";
String google = "http://www.google.com";
String hyperlink = "http://";
int hyperlinklength = hyperlink.length();
int index = mystr.indexOf("http://");
mystr = mystr.substring(0,index)+google+mystr.substring((index+hyperlink.length()),mystr.length());
System.out.println(mystr);
} -
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...
-
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. -
Hi all, i am new to this forum and i hope everyone is doing great.
I have a question on CLOB objects.
I am working on Oracle 8i and i have CLOB object coming from DB2 data base.
Can i apply Replace or Translate function on CLOB data? Because i have special characters like %$^@#. I want to replace all these.
Can anyone help me .
Thanks in Advance.Hi
This article uses DBMS_LOB to mimic the standard replace function for a CLOB. It's for 9i but it may be worth a try to see if it will work on 8i too.
http://www.astral-consultancy.co.uk/cgi-bin/hunbug/doco.cgi?11080
Hope this helps -
Replace function for HTML tags
Hie Guys,
I would like to get rid of the HTML tags from a column/object in my report using the "Replace" function. Basically, I want to replace whatever the content is between "<" & ">" i.e. the opening and closing tags. I know I can use the "Pos" function to identify the position of "<" & ">", but I am not sure exactly how to achieve this in Webi. FYI - "Read content as HTML" & "Read content as Hyperlink" did not resolve the issue. Can anyone please help? Thanks.Hi Jeewan,
It will be very tedious to do this at Webi level.
I have tried below example. It might help you to work around your issue; however, not completely:
1. Created an Excel and inserted single value in first column as:
<html><b>this is yuvraj</b></html>
2. Used it as source and created a Webi report in Rich client.
3. Applied SubStr recursively using Pos function and created below variables:
test : =Substr([column_1]; Pos([column_1];">")+1;Length([column_1]))
test1: =Substr([test]; Pos([test];">")+1;Length([test]))
test2 : =Substr([test1]; 0;Pos([test1];"<")-1)
The output has been attached. -
REPLACE function on a long data type
How can I use the replace function on a long data type?
I am getting ORA-00932: inconsistent datatypes: expected CHAR got LONGThanks so much dainge! Your example helped me to do it. I guess the trick is to put the long datatype into the declared variable first. This is what worked (of course commit after):
declare
l long;
begin
select rppl_sql_statement into l
from rppl
where rppl_slct = 12128;
l := replace(l,'ROPPL96','ROPPL97');
update rppl
set rppl_sql_statement = l
where rppl_slct = 12128;
end; -
I need help for this issue
Have to write a function which calls 2 other functions and use their results to calculate the OUTPUT resturn by the 3rd.
**Already written functions 1 and 2 ,but confused with calculating percentage
function1()--->first one returns the total number of compulsory questions to be ANSWERED in a SUBJECT.(-we get this value as STRING)
Example--->lets say its 5
function2()--->then,it returns the total number of compulsory questions which has been answered by a person for this subject((-we get this value as STRING))
Example--->already answered is 3
Now,have to write a function function3--->which would return the PERCENTAGE of COMPLETION for the person in this subject.
**Have to call functions 1 and 2 then calculate
Percentage is 3/5 * 100 = 60%Hi,
Function definition:
CREATE OR REPLACE FUNCTION fnc_calculate_percentaje(p_current_value IN NUMBER,
p_total_value IN NUMBER)
RETURN NUMBER IS
BEGIN
RETURN(p_current_value / p_total_value * 100);
EXCEPTION
WHEN zero_divide THEN
RETURN 0;
END fnc_calculate_percentaje;Example:
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 v_current_value NUMBER;
3 v_total_number NUMBER;
4 BEGIN
5 v_current_value := 3; -- call to your function using to_number
6 v_total_number := 5; -- call to your function using to_number
7
8 dbms_output.put_line(fnc_calculate_percentaje(p_current_value => v_current_value,
9 p_total_value => v_total_number));
10 END;
11 /
60
PL/SQL procedure successfully completed
SQL>Question: why are you returning strings? If you are specting numbers then return numbers! :)
Regards,
Edited by: Walter Fernández on Mar 15, 2009 1:33 PM
Edited by: Walter Fernández on Mar 15, 2009 1:37 PM - Adding simple exception with zero divide case... -
Hi all,
I need to write a function below scenario
I need to pass two parameters from_date and to_date
i want to get all dates between from_date and to_date except Saturdays and include from_date and to_date also.
Please help me.
Thanks,
Edited by: carmac on Jan 29, 2013 5:04 PMCheck in plain SQL.. Enter the dates inthe format YYYYMMDD
WITH t AS
(SELECT TO_DATE (:dt1, 'YYYYMMDD') startdt,
TO_DATE (:dt2, 'YYYYMMDD') enddt
FROM DUAL)
SELECT *
FROM ( SELECT DECODE (TO_CHAR (startdt + ROWNUM, 'DY'),
'SAT', NULL,
startdt + ROWNUM)
dt
FROM t
CONNECT BY ROWNUM <= (enddt - startdt))
WHERE dt IS NOT NULL;PL/SQL approach (Function):---
CREATE TYPE t_dt AS OBJECT
(dt DATE);
CREATE TYPE t_dt_tbl IS TABLE OF t_dt;
CREATE OR REPLACE FUNCTION fn_ret_dts_no_sat (p_dt1 varchar2, p_dt2 varchar2)
RETURN t_dt_tbl
PIPELINED AS
BEGIN
FOR rec
IN (WITH t AS
(SELECT TO_DATE (p_dt1, 'YYYYMMDD') startdt,
TO_DATE (p_dt2, 'YYYYMMDD') enddt
FROM DUAL)
SELECT *
FROM ( SELECT DECODE (TO_CHAR (startdt + ROWNUM, 'DY'),
'SAT', NULL,
startdt + ROWNUM)
dt
FROM t
CONNECT BY ROWNUM <= (enddt - startdt))
WHERE dt IS NOT NULL) LOOP
PIPE ROW (t_dt (rec.dt));
END LOOP;
RETURN;
END;
/Testing:
select * from table(fn_ret_dts_no_sat('20120101','20120131'));Output:
DT
1/2/2012
1/3/2012
1/4/2012
1/5/2012
1/6/2012
1/8/2012
1/9/2012
1/10/2012
1/11/2012
1/12/2012
1/13/2012
1/15/2012
1/16/2012
1/17/2012
1/18/2012
1/19/2012
1/20/2012
1/22/2012
1/23/2012
1/24/2012
1/25/2012
1/26/2012
1/27/2012
1/29/2012
1/30/2012
1/31/2012Cheers,
Manik.
Edited by: Included Function approach. -
Joker characters in the search and replace function
Hello everyone,
Just a quick question :
I was wondering what character can be used as a joker character in the search and replace function (I did a research in the site, but didn't find any thread)
To be clear, I have misspelled a word, for example «trouser».
I know I didn't make any mistake with the first and last letter, but sometimes I wrote it «tourser», «turoser»
(sorry if there is a weird meaning, i'm french, and for me it won't mean anything, so don't take it personally)
I would like to be able te replace all the versions of «trouser», even the good ones, using «t*****r» in the search and replace function.
I tried the «*» character, but it's not the jocker.
Thank you for your help !As I can't edit my first message, just wanted to let you know it's also called «wildcard» characters
Like here (Careful, it's… Ms Office) -
I have an String which contains , and : in it. I want to replace , and : with some values.. How can i do this using single replace function..
Note: Using only single replace function i have to replace these special charecters..
Can you help me...Hi !
Why not REPLACE(REPLACE(YourField, ',', 'value1'), ':', 'value2') ?
Where value1 is the value that will replace the ',' and the value2 will replace ':'.
Hope this will help, feel free to ask more !
Max -
Function help - Tournament data copying
Hello,
I am currently making some sheets for a Tournament coming up soon and was just wondering if there is a way to automatically fill out the Quarter Final brackets using the Qualifying table and functions. For example, only checked rows from a certain section will be copied over.
Here's some screenshots of what I want to do:
Please could someone help me out a bit?
Thanks in advance
LeonIn what way?
I haven't set the functions yet, I've just manually inputted the data to show what I want to do automatically
I thought I could use the REPLACE Function
I tried REPLACE(Qualifying::Table 1::B2:B5,IF(Qualifying::Table 1::E2:E5,TRUE)) but that obviously didn't work haha
Basically I want a name from Qualifying B2 to B5 to be copied to Finals Table 1 A1 if the checkbox on the same row is checked -
TestStand Design Search/Replace Functionality
We are in the process of changing from using Measurement Studio/Visual Basic to using TestStand as the test executor. (We are just learning to use TestStand and LabView.)
Currently, all testing is done using VB as the low level calls, and VB scripting for the test automation.
Our plan is to start by putting the VB low level code into an Active-X DLL and as time permits, move the low level code to LabView.
The question is, as we create replacement functions using LabView, how do we Replace the Active-X DLL calls with the LabView functions?
My first thought was to use "Search and Replace" (as there is in most other language enviornments) but I can't find such a function in TestStand. IS THERE A WAY TO DO THIS?
M
y other thought is to somehow create a subsequence for EACH library call that points to a single block for that function, where that single block can be changed from the Active-X DLL call to a LabView call.
Examples would be that we have a Read/Write Parameter function as:
ReturnStatus=DLL_Parameter(Name,Instance,Value,Mode)
We would eventually create a new function in Labview and would want to replace ALL instances of the DLL call with a similar LabView function.
How do we design this in?
MikefUnfortunately a search/replace feature has only been introduced in the new TestStand V3.0. It allows for searching and some replacing of values, properties, etc. however this may not help what you are describing.
It is possible to write you own custom search/replace code that uses the TestStand API and can scan through a sequence file for particular step names or types and then insert a new LabView Step and remove the old DLL call step.
If you need to keep the DLL parameters you can access them using the Step.TS.SData cluster. (You may need to set the �Show Hidden Properties� in the Station Options to see this in the Sequence Editor).
Check out the TestStand API Reference and some of the Examples included in TestStand on how to use it.
Hope this helps
Simon Holman
Simon Holman
Software Engineer
Certified LabVIEW Developer
Certified TestStand Developer
measX GmbH & Co. KG.
http://www.measx.com -
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
Maybe you are looking for
-
Problem pdf created by Epson Printer.
When I open a pdf created by my Epson printer (WF-7620) I am asked to install an Asian language pack. I do not want to install this pack. How do I stop it? I have contacted Epson support who told me to contact Adobe as they could not see a way to sto
-
Po header change after release
Dear All We require list of PO for last one month PO header or tiem level text has been changed after release Regards Dishant
-
Genymotion plugin, path to application
Hi, I installed genymotion from aur, is working fine, I can add virtual devices and run it, I install the genymotion plugin in android studio, it need to set the path to the genymotion folder but nothing is working, I try genimotion location with "wh
-
IPhone Map & Tom Tom iPhone hands-free kit
Hi everyone - can anyone help me with this teaser? I recently bought a Tom Tom hands-free kit to use my iPhone 4S in my car. I am having trouble with audio... I have been able to connect the phone with the TT unit via Bluetooth, and after talking t
-
Will I lose my quicktime pro if i update QT player??
I have an EyeTV (el Gato, the coolest tv system) on my old G4 and just a minute ago, I updated it. Found out there's a wi-fi capability that can upload my recorded tv shows to my iphone (via the internet). So I enabled it but it prompted me to upgrad