Returns all occurrences of a substring
HelloI have a problem with the reference to the data in a list.
I can contain the values of the fields such as (going after MTC):
* MOCS13; MTCIN13; MTCIN14; 100-14; 111 IN IN 14; 123 14
* MTCIN13; MTCIN14; 100-14; 111 IN IN 14; 123 14
* MOCS13; MTCIN13; MTCIN14
* MOCS13; M100IN14; 111 TO 14; 123 IN 14
* ...
* MTCXXX can have different sizes and can be anywhere in the area.
* The cams of information in a list, so it is ordered, if there is more then a TCM it will be come to the front.
* "MTC" is always;
first of all, I just need to check if the information exists, then I did this:
Decode (REGEXP_SUBSTR (Upper (Concat(';',List)), Upper(';) MTC ^; +')), NULL, 'FALSE', 'TRUE') AS MTC
and it was OK
then there was asked to return the value full and I did this:
NVL (substr (REGEXP_SUBSTR (Upper (Concat(';',List)), Upper(';) MTC; +')), length(';mtc')-2, length (REGEXP_SUBSTR (Concat ('; ', List),';)) MTC; +'))),' ') IN TCM
now that I did this, I was told that there may be several occurrences and that I must return all values!
I ordered the list to make this easy, but I'm not currently in a position to get the right expression to get the set of values!
can someone help me?
Thank you
Ricardo Tomas
And if you are looking for the same sort of output as input.
SQL> ed
Wrote file afiedt.buf
1 with t as (select 'MOCS13;MTCIN13;MTCIN14;100IN14;111IN14;123IN14' as list from dual union all
2 select 'BOB13;MTCIN23;123IN14' from dual union all
3 select 'MTCIN11;123IN14;MTC123X' from dual
4 )
5 ,t2 as (select list, row_number() over (partition by list order by 1) as pos
6 from t, (select rownum from dual connect by rownum <= 100)) -- assumes never more than 100 entries in list
7 select list, ltrim(sys_connect_by_path(mtcs,';'),';') as mtcs
8 from (
9 select list, ltrim(REGEXP_SUBSTR(';'||list,';[[:alnum:]]*',1,pos),';') as MTCs, row_number() over (partition by list order by 1) rn
10 from t2
11 where ltrim(REGEXP_SUBSTR(';'||list,';[[:alnum:]]*',1,pos),';') like 'MTC%'
12 )
13 where connect_by_isleaf = 1
14 connect by list = prior list and rn = prior rn+1
15* start with rn = 1
SQL> /
LIST MTCS
---------------------------------------------- ------------------------------
BOB13;MTCIN23;123IN14 MTCIN23
MOCS13;MTCIN13;MTCIN14;100IN14;111IN14;123IN14 MTCIN13;MTCIN14
MTCIN11;123IN14;MTC123X MTCIN11;MTC123X
SQL>
Tags: Database
Similar Questions
-
Remove all occurrences of the string in the string
Hello.
We have a problem with the change of all occurrences of a string in string.
We know how to do the hard, but what would be the easiest?
We have a string like:
2014/00212, 2014/12312, 2013/23443 2014/20156
or simply as
2014/00212
or there may be several occurrences of substring in the form xxxx/xxxxxx.
How can we change channel:
14/00212, 14/12312, 13/23443 14/20156
Thank you.
If I understand you want to replace every 20 at the beginning of each part of the entire string.
The rooms are separated by a comma and consecutive space. He also begins with this separation.
The part of the year is separated by a slash from the rest of the part
Select
regexp_replace (' 2014/00212, 2014/12312, 2013/23443, 2014/20156 ')
', 20'
,'\1'
) r
of the double
R
", 14/00212, 14/12312, 13/23443 14/20156.
or simply
Select
Replace (' 2014/00212, 2014/12312, 2013/23443, 2014/20156 ')
', 20'
,', '
) r
of the double
R
", 14/00212, 14/12312, 13/23443 14/20156.
-
return all the possible model of a string
Hi all
I would like to return all possible models from a given string, for example when a string is "ABC", I should get
ABC
ADJUSTED COST BASE
TRAY
BCA
CAB
CBA
as well as
AAA
BBB
CCC
ABB
VAC
BAA
BCC
CAA
CBB
I could write this:
Select permut
from (select replace (SYS_CONNECT_BY_PATH (e, ',') ',') permut)
of (SUBSTR ('ABC', level 1) select e)
of the double
connect by level < = length ('ABC'))
connect e nocycle! e = prior)
where length (permut) = 3
but the output is just:
ABC
ADJUSTED COST BASE
TRAY
BCA
CAB
CBA
any ideas? for ora10g or 11g sql/plsql
Thank youThis is similar to the solution of Frank, but somewhat simpler:
with indata as ( select 'ABC' txt from dual ), chrs AS ( select substr(txt,level,1) chr FROM indata CONNECT BY level <= LENGTH(txt) ) select replace(sys_connect_by_path(chr, '/'), '/', '') permut from chrs where connect_by_isleaf = 1 connect by level <= (select length(txt) from indata);
[Edit: I guess the main difference is that I don't see the need to SEPARATE.]
Published by: stew Ashton on 18 January 2013 13:58
-
Function to return all the variables in the expression list on 50 G?
What is the function on the 50G will return all variables used in algebraic exoression list?
Example entry:
(x + y) ^ z / x
output:
{x y z}
Hello Chris_Chen,
the command "LNAME" does what you want, but you get the result as a vector, not a list.
For example: ' Q ^ 2 - SIN (XT)'-> [Q XT]
But this can be easily converted into a list: < < OBJ-> OBJ-> MENU-> LIST > >
Cordially calcpeace
-
void vi returns all of the elements
Basically, my sub vi returns only a single value for each iteration of the loop. I read 10 samples at a time, then I lose 9.
I thought to build a table, the vi sub running in a loop with automatic indexing. the problem with this is that it only returns the last value, except if I build an array out of the loop. downstream, I double sinks, so I can't connect the table. Is there a way to convert the table 1 d in the flow of 10 items, so that simple math corrections can be performed downstream? Is there another solution to make the sub vi return all ten samples?
-
Hi all
I'm looking for an easy way to find all occurrences of a term, through multiple Word documents and review of each instance of the word in its local context (i.e. extracted) without having to open each document.
For example, if I want to search the term "religious atmosphere", the search results would be something like:
Paper 22: '.. '. but the religious atmosphere had not evolved to the point where... »
Paper 22: "...". not that the religious atmosphere was still too controversial for a settlement... »
Document 35: "...". If anything, the religious atmosphere was still little developed for a city... »
Document 35: "...". it in no way improve the religious atmosphere until the decision was... »
Paper 42: '.. '. up to - what point, the religious atmosphere was very collegial with all the elements of... »
Any Microsoft or utility 3 rd-party which can put each instance-by-side and in a context extract would be a real, real help!
Any ideas?
Thank you
Jay
Ken is perhaps more familiar with the Agent Ransack, I am, but a quick check she finds every instance of a string of text and shows the term in the context of a single line subject to the following:
- At the end of the search, a list of the files found is accompanied by some statistics.
- If you select one of the files found, each 'hit' for this file is displayed in the context of a single line. In other words, you get a list of hits in context as in your original question. Instead, you get a list of, say, 42 documents and then if you have selected the Document 22, you will see:
- «.. but the religious atmosphere had not evolved to the point where... »
- «.. . not that the religious atmosphere was still too controversial for a settlement... »
- The display of content seems to work with OK * .doc, *.docx and files *.pdf; not so many other types of files - even if it looks for text in all kinds of other files.
Agent Ransack is free. Download and try it. If you don't like, just uninstall.
-
Need help to create a search form that returns all values on this line
Hello
I have a pdf document that lists every zip code unique to the USA and for each line, it has five columns of information for each zip. Using the integrated search, when the user key a zip code, the cursor jumps to that page and highlights only the postal code, making it difficult to read the other five columns.
Not sure if this is possible, but it would be the ideal solution:
Enter the postal Code: [search] _ <-user key a zip code if found, return all columns in the same row in the report below
Group: ___________
Description of the Group: _
Mkt Area ____________
City ____________
State ___
This can be done (in the PDF file), but it requires a script to measure.
The worksheet data should be converted to a crude and attached text to the PDF file, and then the script could read and fill in the fields on this basis.
If you are interested in hiring someone to develop this script for you, feel free to contact me privately at try6767 at gmail.com
-
Find and replace all occurrences of a string within the current paragraph.
I did so much work, and it's my last method to implement.
I want to get the current active doc the current paragraph and replace all occurrences of a string inside this paragraph with another string.
For example, say I have the following paragraph in a document:
«This is a sentence that.» This is another sentence. It is also another sentence. The sentence ".
If the user opens the document containing the paragraph and goes to this paragraph by clicking in any place in there, I want to replace e.g.g "another punishment" with "phrase.
But only in the current active paragraph in the active document.
I found a code with F_ApiFind and F_ApiGetTextRange to get the current text selection, but I can't think of a way to do it.
Post edited by: Efstathios Chatzikyriakidis
Problem solved people. Thank you.
-
create table ab (a number, b varchar2 (20));
Insert into ab
Select rownum, rownum. "" sample "
of the double
connect by level < = 10
create table bc (a number, b varchar2 (20));
Insert into BC.
Select rownum + 1, rownum + 1 | "" sample "
of the double
connect by level < = 10
Select * AB
where b in (select b BC where b = "2sample")
This query will return me 1 row, but there are cases where the value of the parameter b is null
and that it should return all rows in the table
as
Select * AB
where b in (select b BC where b = "2sample")
which return specific values, but I want to change in a way when the inner query returns nothing then outer query should return all the lines and works as
Select * AB;
Is it possible to put in a single query
Hello
You seem to ask for different things. You want all the lines AB when
- The parameter ("2sample' in the example) is NULL, or when
- There is no corresponding row in the 2 tables (which could happen even if the parameter is not NULL)
?
Assuming you want the option 2, here's one way:
WITH got_rnk AS
(
SELECT ab.*
DENSE_RANK () (ORDER IN CASE
WHEN b (IN)
SELECT b
BC.
WHERE b = "2sample" - parameter
)
THEN "A".
OF ANOTHER 'B '.
END
) AS rnk
AB
)
SELECT a, b
OF got_rnk
WHERE rnk = 1
;
This does not assume b is unique in each table.
Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.
-
Hello.
I work in a big project on my main composition in 2015 of EI, Yosemite 10.10.5 and always return all night but cannot give more than one inside and out...?
If I give several definitions in my composition to queue rendering, After Effects rendered all points, but only the last again and again.
I never need to make multiple files during the night, so I don't know if this is normal or there at - there a Posibility to return more control then a?
Kind regards
Florian.
It's one of these bugs CC 2015. It would be possible to set using render settings different, it seems to occur with specific formats.
Mylenium
-
I have a paid subscription of CC, but it keeps returning all the apps in the "trial" versions
I have a paid subscription of CC, but on one two computers, it keeps returning all the apps to 'trial' often to 0 days versions. How do the versions "paid / activated ' stick?
Hi C marwa,
Please check the help below document:
Creative Cloud applications unexpectedly back in the test mode. CS6, CCM
Kind regards
Sheena
-
Expand/retract all occurrences of the text in menu drop-down in a topic
I was unable to find anything about this is on this issue so please forgive me if I have missed somewhere.
I'm working on a webhelp in RH0 project which uses a LOT of drop-down text. One of the problems is that I can't find a way that it is possible to expand or reduce (i.e. + or)-all occurrences of the text in menu drop-down in a topic once it is in WebHelp output.
Thank you!
Tests - http://www.grainge.org/pages/authoring/twisty/twisty.htm or http://www.wvanweelden.eu/blog/2013/09/04/expand-selected-drop-downs-default
-
Returns all of the rows matched and unmatched table
Hello:
I have a table that have senders A, B and D. This is my script that returns all the shippers have those amounts:
Select sender,
flat amount
from TABLE1
where the sender in ('A', ' B', 'C', ' d ', 'E')
Group by sender
order of the sender
Amount of the sender
-------------------------
A 10
B 40
D 50
But I need the output as below:
Amount of the sender
-------------------------
A 10
B 40
A r
D 50
E 0
Can someone help me?
Thanks for advance/RazinHi, Razin,
Outer join a table (or, as in the example below, as a result set) which contains a line for each sender you want displayed to your actual table, like this:
WITH all_senders AS ( SELECT 'A' AS sender FROM dual UNION ALL SELECT 'B' FROM dual UNION ALL SELECT 'C' FROM dual UNION ALL SELECT 'D' FROM dual UNION ALL SELECT 'E' FROM dual ) SELECT a.sender , NVL ( SUM (t.amount) , 0 ) AS total_amount FROM all_senders a LEFT OUTER JOIN table1 t ON a.sender = t.sender GROUP BY a.sender ;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
You already have a lookup table that contains one row for each possible sender. If so, you can use it instead of the above subquery. (If you do not already have such a table, think about creating one).
-
Returns all the duplicate values in object lookup (PHP, drop-down list)
Hi, I have a PHP page I designed as a search page. I have a number of drop-down lists that get their dynamic values from the fields in a MySQL database.
At present, if there are any entries that have duplicate values in a certain area, they are all listed, in the order of the index database. For example:
City:
Derby
Stoke
Stafford
Stoke
Derby
Derby
Stoke
etc...
Now, I want to do is be able to show all results for a given city. In the find what drop-down list box, I would than each of the cities to appear only once rather than every time it is registered. included in this, I would like the page of results to then display ALL results that match this search criteria.
Thus, in the example above, "Derby" appears only once, but when the user has selected 'Derby', it would return all three results in the results page.
My results page is built on a dynamic form, so I am confident that the results page would make it according to the needs. However, how can I get the drop-down list box to ask him?
> 'SELECT DISTINCT table1.champ1, table1.champ2, table1.champ3 FROM Table1 ";
Duplicate rows to remove the DISTINCT keyword strength SQL. In other words, that it will only return the unique combinations of fields in your selection list. If you examine your results set, you will see that each line is separate, although there may be duplicates in a particular area. Because you want to populate a drop-down list, you must include a field in your select list only, otherwise you get of the dupes.
-
Get all occurrences of a Word.
Hello
Is it possible to find all occurrences of a word in a single document using Oracle text?
Or maybe a count of how many times a word appears in a document?
I had a glance at the documentation and the web and don't think it is, could anyone suggest a way to do this?
Thank you very much
Darren.Hello
You can, as Roger said to use ctx_doc.tokens. This works if you already have a clue (text) on the document. You also have the option to use ctx_doc.policy_tokens. This does not have a clue, but needs a policy. The two proceedings are with examples in the Manual: [url http://download.oracle.com/docs/cd/E11882_01/text.112/e16593/cdocpkg.htm#CEGCIDAJ] package CTX_DOC.
Herald tiomela
http://htendam.WordPress.com
Maybe you are looking for
-
Firefox stucks for a while at the launch
Hello! I have just unstinalled Office 2013 Office365 subscription.Since then, Firefox stucks for a few seconds when started (cannot type or interact with Firefox for 4-5 seconds). I completely deleted Firefox, deleted the profile folders and registry
-
In Windows 2003 Server Standard Edition SP2, Event Viewer is view any access to the system and the events of the same Application in Administrator account.
-
I have a Windows 7 Fujitsu Lifebook (5 years). I tried to update to Windows 10 without success. Finally after a Windows7 update and then upgrade Windows 10. Success! Remotely, the company THAT THIS guy decided that I had to update W10, now all I get
-
BB user new blackBerry Smartphones does not include
How can a phone be a modem? I probably should, but I did not. I've seen it mentioned a couple of times on this forum and on crackberry forums. It's my first smartphone and my first blackberry. I love the phone, but I want to make sure that I explore
-
Since my upgrade, I can access is no longer my Nexus 7 Tablet nor my EVO 4 G LTE phone on my computer via a USB cable. I searched the Internet far from help. So far, it seems that no one can connect via USB. Thanks a bunch of Microsoft.