Get the string between two operators <>
HelloI have a string that looks like this "text here < emplid > more text here '." Now, I want to choose the data between the < and >. These data is still a number. I tried the following query, but it does not give good results.
select SUBSTRING(NAME,CHARINDEX('<',NAME),CHARINDEX('>',[NAME])) as col01
from databasename
This will result in the number, including the < and > (which I'm not) and some characters more. I also need the rest of the chain to be available to insert in another field.Published by: wijnandgritter on 23 January 2012 0:03
Hello
You should be able to
update tablename
set field = regexp_replace(fieldname,'^.*<(\d+)>.*$','\1 this is an employee')
where fieldname = '123'
or something similar...
HtH
Johan
Tags: Database
Similar Questions
-
I haven't used regular expressions before, and I can't find a regular expression to extract a subset of the string between two markers.
The chain;
Stuff of header I want
Stuff of header I want
Stuff of header I wantStuff of header I want
Stuff of header I want
Stuff of header I want6 ERRORS
Info I want to line 1
Info I want line 2
Info I want line 3
Info I want to line 4
Info I want to line 5
Info I want line 6
END_ERRORSFrom the string above (it is read from a text file), I try to extract the subset of string between ERRORS 6 and END_ERRORS. The number of errors (6 in this case) can be any number from 1 to 32, and the number of lines I want to extract will correspond with this number. I can provide this number of a caller VI if necessary.
My current solution, which works, but is not very elegant;
(1) using Match Regular Expression for the return of the string after you have synchronized the 6 ERRORS
(2) uses the Regular Expression matches to return all characters before game END_ERRORS of the string returned by (1)
Is there a way this can be accomplished using 1 Regular Expression Match? If so someone could suggest how, as well as an explanation of the work of the given regular expression.
Thank you very much
Alan
I used a character class to catch any word or whitespace characters. This put inside parentheses a substring matching the criteria that you can get by developing the node for regular expression matching. The \d matches the numbers and the two * s repetition of the previous term. So, \d* will find the '6', as well as "123456".
-
Dynamic action - Get the difference between two dates + times
I have problems a little dynamic to work action. I'm trying to get the time between two dates with the time difference.
Here is what I got (this is apex 4.0):
Two date pickers + two numbers fields (date/start/end times)
I created a dynamic action on the page who fires on the point lose focus (above points).
The real action for the DA is the body of the PL/SQL function:
When I change the values on the page, I get the following error:declare end_date DATE; start_date DATE; Begin start_date := to_char(:P1_START_DATE || ' ' || :P1_START_TIME, 'DD-MON-YYYY HH:MIAM'); end_date := to_char(:P1_END_DATE || ' ' || :P1_END_TIME, 'DD-MON-YYYY HH:MIAM'); :P1_HOURS := end_date-start_date; End;
AJAX call back Server error ORA-06502: PL/SQL: digital or value error: character number conversion error to set the value.
I'm guessing that there is a problem with the date formatting, but I can't make it work. Thanks in advance!Hi djston,
because you chose the dynamic action of 'Set value' with the "Body of the PL/SQL function" type you need to return the value. Try the following code
declare end_date DATE; start_date DATE; Begin start_date := to_date(:P1_START_DATE || ' ' || :P1_START_TIME, 'DD-MM-YYYY HH:MIAM'); end_date := to_date(:P1_END_DATE || ' ' || :P1_END_TIME, 'DD-MM-YYYY HH:MIAM'); RETURN (end_date-start_date)*24; End;
and P1_REQUESTED_HOURS like 'item affected. "
Concerning
Patrick
-----------
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolfPublished by: Patrick Wolf on January 17, 2011 10:54
-
The most elegant way to get the difference between two tables - not least!
Hello
Simplified example of what I'm trying to achieve - I have two tables ORIGINAL and REVISED.
My aim is to compare the two, such as; -
When there is data in the two tables I get the difference between the Budget column, and if there is no difference, so I don't want no lines.
When data exists in the ORIGINAL, but not in review, I want to the inverse of the current value of the Budget column.
Where the data exist in REVISED I want the REVISED value.
I can see how I can do this, see below, but is there a more elegant solution?
Data for the ORIGINAL table
Data for the REVISED tableselect '801040' entity, '2186' expense_type, 234000 budget from dual union all select '801040' entity, '3001' expense_type, 1000 budget from dual union all select '801040' entity, 'P132' expense_type, 34000 budget from dual union all select '801040' entity, 'P135' expense_type, 43000 budget from dual
Desired outputselect '801040' entity, '2186' expense_type, 235000 budget from dual union all select '801040' entity, 'P132' expense_type, 34000 budget from dual union all select '801040' entity, 'P139' expense_type, 56000 budget from dual
ENTITY EXPENSE_TYPE DIFFERENCE
------ ------------ ----------
801040 2186 1000
801040 3001-1000
801040 P135-43000
801040 P139 56000
5 selected lines.
Code current to achieve this, is there a better way?
Thanks a lot for your comments,.select original.entity , original.expense_type , (nvl(revised.budget,0) - original.budget) as difference from original , revised where original.entity = revised.entity(+) and original.expense_type = revised.expense_type(+) and (nvl(revised.budget,0) - original.budget) != 0 union all select revised.entity , revised.expense_type , revised.budget as difference from revised where not exists (select 'x' from original where original.entity = revised.entity and original.expense_type = revised.expense_type) and revised.budget != 0
Robert.
Published by: Robert Angel on January 17, 2012 03:31 to change is not equal to! = - Thanks for the heads upSQL> with original 2 as 3 ( 4 select '801040' entity, '2186' expense_type, 234000 budget 5 from dual 6 union all 7 select '801040' entity, '3001' expense_type, 1000 budget 8 from dual 9 union all 10 select '801040' entity, 'P132' expense_type, 34000 budget 11 from dual 12 union all 13 select '801040' entity, 'P135' expense_type, 43000 budget 14 from dual 15 ) 16 , revised 17 as 18 ( 19 select '801040' entity, '2186' expense_type, 235000 budget 20 from dual 21 union all 22 select '801040' entity, 'P132' expense_type, 34000 budget 23 from dual 24 union all 25 select '801040' entity, 'P139' expense_type, 56000 budget 26 from dual 27 ) 28 select * 29 from ( 30 select nvl(o.entity, r.entity) entity, 31 nvl(o.expense_type, r.expense_type) expense_type, 32 nvl(r.budget,0) - nvl(o.budget,0) budget 33 from original o 34 full join revised r 35 on o.entity = r.entity 36 and o.expense_type = r.expense_type 37 ) 38 where budget <> 0 39 / ENTITY EXPE BUDGET ------ ---- ---------- 801040 2186 1000 801040 P135 -43000 801040 3001 -1000 801040 P139 56000 SQL>
-
get the string between {}
IN the string I want to take all values between {and}.
This is the string.
({Location1} # tie # 12-< and > {Item1} # top # (8) < and > {Item2} # # (40) < and > {DOCDATE} "# # 10 January 2015" AND 10 January 2017 ' < and > {amount} # tie # 1).
Vinodh
Here's a way to do what you asked (which may or may not be what you need), using REGEXP_REPLACE to remove everything that is not between two brands of {}:
with t as
(select ' ({Location1} # equal (12) < and=""> {Item1} # more than # (8) < and=""> {Item2} # # (40) < and=""> {DOCDATE} # between # "January 10, 2015" AND 'January 10, 2017' < and=""> {amount} # equal # 1)' txt)
the double)
-end of test data-
Select regexp_replace (regexp_replace (regexp_replace(txt,'}[^}]*{','',1,0),'^ [^ {}] * {', ", 1,0}) {,'}. * $',", 1.0)
t
-
SQL query to get the dates between two dates
Hello
We have a chart with start date and end date... Now I need to get all the dates between the start date and end date...
Table looks to below...
Create the table date_table (start_date, end_date date);
The table data will be as below:
start_date end_date
January 1, 2013 January 4, 2013
February 1, 2013 February 3, 2013
............... .................
............... ..................
............... .................
May 1, 2013 may 3, 2013
I want a result like below...
holiday_dates
January 1, 2013
January 2, 2013
January 3, 2013
January 4, 2013
February 1, 2013
February 2, 2013
February 3, 2013
.................
.................
.................
.................
May 1, 2013
May 2, 2013
May 3, 2013
Can anyone help... ?
Ramesh9158 wrote:
Hello
Your query will not work for our case...
First... We do not know the number of rows in the table... If we cannot use the union...
Second... hard coding of dates... but we do not know what could be that goes back in the table... it could be no matter what it takes not only as appearing to the interpreter...
Hey riri.
My code will work everywhere I use with with union all statement to create the example data.
Try the query:
-The main query
Select d1 + row_number() over (partition by iden) - stopped by iden holiday 1
Of
connect by level<= d2="" -="" d1="" +="">=>
and prior iden iden =
and prior sys_guid() is not null
----
Ramin Hashimzade
-
How to get the date between two dates, except Saturday and Sunday
Dear all,
The query above returns the following outputselect to_date('25-04-2012', 'DD-MM-YYYY') + rownum -1 dt from dual connect by level <= to_date('05-05-2012', 'DD-MM-YYYY') - to_date('25-04-2012', 'DD-MM-YYYY') + 1;
Here, I need to exclude Dates that lights up "Saturday" and "Sunday" and also the joint birthday partyDT DT 04/25/2012 04/26/2012 04/27/2012 04/28/2012 04/29/2012 04/30/2012 05/01/2012 05/02/2012 05/03/2012 05/04/2012 05/05/2012
Here it is May 1, 2012 "and I need the output as follows,
I need the current request to calculate between two dates.04/25/2012 04/26/2012 04/27/2012 04/30/2012 05/02/2012 05/03/2012 05/04/2012
Can anyone suggest me?
Thank you
Regsrds,
gurujothiselect dt from( select to_date('25-04-2012', 'DD-MM-YYYY') + rownum -1 dt from dual connect by level <= to_date('05-05-2012', 'DD-MM-YYYY') - to_date('25-04-2012', 'DD-MM-YYYY') + 1 ) where to_char(dt,'fmday') not in ('sunday','saturday')
To exclude, common holiday, you must have a host table. Then use an OUTER JOIN NOT IN or NOT EXISTS
-
Read the string between two characters
I have an xml file that is saved to a text file, and the XML was not in Labview. I want to be able to read each line of the text file and display the text that is between ' > '.
I'll leave the text as an attachment file.
This could give you some tips, but you have to play with it to get properly what you want. I'm not really good at manipulating strings and not too familiar with regular expressions, I'm sorry...
-
Find the difference between two date and time
Hi friends,
I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."
select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed from eval.EVAL_RUNTIME_DETAILS where trunc(start_date) = trunc(sysdate) order by sql_step_num;
You try to get the feel between two char strings.
And more difference between two dates gives a NUMBER of days.
Try this:select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed from eval.EVAL_RUNTIME_DETAILS where trunc(start_date) = trunc(sysdate) order by sql_step_num;
-
Trying to get the 'difference' between the two tracks
What I'm trying to accomplish is the following: I have an audio track of a voice-over with a music bed located underneath. I also itsself Chamber music, without the voiceover. I want only the share of voice. Is it possible that I can "cancel out" the part of the music or get the difference between the two tracks (just the voice part)? It seems that there should be a way to do it, but for the life of me I can't figure out how do it!
Any advice?
There you go...
http://www.libinst.com/audio%20DiffMaker.htm
Unfortunately, the above utility has been abandoned by its author. :-(
It only works on Windows XP, to start...
-RFH
-
How to get the value of EV - the diiference between two different columns
Hello
I get the difference between the two different columns of two different... as tables (emp.sal - dept.comm)... all I want is I need only the records that a negative gap how get this? Please help me
Thanks in advanceIf I understand your question right:
select case when emp.sal-dept.comm>=0 then YOUR_VALUE else emp.sal-dept.comm end difference_value from emp,dept...
or do you want to:
select ... from emp,dept... where emp.sal-dept.comm<0
?
Kind regards
Sayan M.Published by: xtender on 19.11.2010 22:29
-
Take the time between two values
Hi people,
I have a problem and I know idea how to solve... I need help.
The problem is I want to take the time between two values max as you can see in the chart.
For example, in the image that I have add
4.5 - 1 840 = 2.66
And enter this value in the 'time between mostra '.
It's that I want...
But what I think is very complicated, because I don't know how to take the time correctly and does remove...
Thank you very much
Any solution?
Hi jocuma,
I tried something and hope that helps u.
Just create two arrays of temperature and voltage. First of all, I'll get the value of the voltage when it is more of a certain value and that same index to get the value of time and store in the shift register.
When I get the second higher than the limit value, I'll get time and subtract the previous value.
-
Query to get the difference between 2 totals of 2 different queries
I wanted to know if it is possible to get the difference between 2 totals of 2 different queries. Let me explain with an example:
1 application ofst - sum (homepass) Select table 1
2th query: select sum (homepass) from table2
Is it possible to display the difference as -
Select sum (homepass) in table 1 - sum (homepass) from table2
I know that the above query would give syntax error, but is there a better way or something to get the above done task from a single query.
Hopefully, my question is clear.
Please get back with the answer to my query.
Concerning
You can always do something like
SELECT a.cnt - b.cnt FROM (SELECT sum(homepass) cnt from table1) a, (SELECT sum(homepass) cnt from table2) b
I'd be somewhat dubious, although on a data model that had two tables with the same name of the column where it really made sense to subtract one amount from each other. This would strongly imply that there should be a single table with an additional column TYPE eventually.
Justin
-
How to tell the difference between two dates
Hello:
I have a question on how to get the difference in quantities for two dates in the replies and dashboard.
This is the scenario. I have two guests date and three columns. The first column must be the sum of the amounts for the first quick date. The second column should be the sum of the amounts for the second fast date. And the third column is the difference between the first two columns.
Basically, I'm trying to do something similar to a function of sum of two lines but trying to get the difference between the two rows. Any help to solve this problem would be appreciated.Use the COLUMN FILTERS level...
the first column with the first variable of date quick presentation of the filter
Similarly, the second column in the second variable of quick overview of date filter
Kind regards
Rambeau -
How to get the string (specified by row and column) of txt file with labview
Hello world
How to get the string (specified by row and column) of txt file with labview
THX
As far as I know, a text file has no column. Be more specific. Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character? You can read from the spreadsheet String function and set the delimiter to a space. This will produce a 2D channels table. Then use the table to index and give the line number and column number.
Maybe you are looking for
-
10.11.6 updating killed my apps from user account
I just installed the latest updates on the App Store (10.11.6 I guess) to find when restarting the Apps on my main user account (an administrator account) no longer work. The account is running very slow and lazy, struggling to load anything and beac
-
Hello, I have a problem with Mozilla Firefox 14 and now also Firefox 15. When I click on .html files on my desktop, firefox will open a new window twice. Where is the problem? Thank you
-
Pavilion 15-p028tx: Upgarde my laptop hhd for ssd
Hello team, I have computer hp Pavilion 15-p028tx laptop and I want to migrate disk ssd. My machine is runing on windows 10 real operating system right now. My question is that how can I recover my windows Genuine 10 after installing ssd? I'm waiting
-
How to restore the default font in Windows XP?
HI - it seems that Wingdings is no longer available on my computer. Is there a link where I can restore this font? Thanks--dl
-
Blue error screen need to fix has the screen 4 times in 24 hours
receiver code 0x0000007f and 0x0000000d referring to name of file lvckap.sysAlso the code 0x0000007e, 0xc000008f, 0xede5549c, 0xec373b08, 0xec373804, with the name lvckap.sys, hal.dll and ntoskrnl.exe I want to solve this problem so that the screen n