Extract everything after a string

Hi all

I'm using Oracle 11 g.

Let "considering the following:"

create table xx_test (col1 varchar2(250));

insert into  xx_test values ('where 1=1 order by 1 desc');
insert into  xx_test values ('where 1=1');


I need to extract of col1 everything after "order by".  In this case, the result, I need is "1 desc" and null (1st and 2nd row of the table).

Seems very easy

Any ideas?

Kind regards

Stoyanov

Select instr (col1, 'order by') case when 0 then null

of another substr (col1, instr (col1, 'order by') length ('order by') + 1) end

of xx_test

/

Edit - as stated above by other posters who are faster than me

Tags: Database

Similar Questions

  • Extract text from a string

    How would extract everything before and after the LAST - (dash)?

    Example: mt-st-marys-fl...

    Everything preceding the latest scoreboard: mt-smarys

    Everything that follows the latest scoreboard: fl

    Before last dash: Replace(string, "-" & ListLast(string, "-"), "")
    After: ListLast(string, "-")
    

    Mack

  • migration from Outlook Express loses everything after 'group '.

    Hello
    I migrated from Outlook Express to Thunderbird on XP, then moved the files to Windows 8.
    I had a 'group' in my OE address book. Nothing after that that group name (which began with an H) has been migrated to the new address book. In other words, I lost everything after H.

    I also have these contacts on Gmail. Y at - it an easy way recover of EO (I guess I could remove the Group and start over, but it's a long process and I'm afraid to lose the mail I already sent on tuberculosis), or y at - it an easy way to get from gmail?

    Thank you.

    S

    There are several solutions to your problem, which is the best for you which I do not pretend to know.

    There is the possibility of simply to copy the WAB to outlook express for Windows 7 and double click it to him bringing in the windows contacts folder. I have instructions here http://thunderbirdtweaks.blogspot.com.au/2013/12/windows-contacts.html that include the Windows Contacts folder in Thunderbird.

    Alternatively, you can install one of the Add-ons to gmail contact sync. I use https://addons.mozilla.org/en-US/thunderbird/addon/google-contacts

  • Replace after specific string

    Hello people,

    I have the query on 9i below:
    SELECT ERRMESSAGE FROM USER_LOG;
    And he'll be back:
    http://somepath/somepath/somepath/somepath.aspx form visit at:prod - Client:10.10.101.243
    http://someotherpath/someotherpath/someotherpath/someotherpath.aspx form visit at:prod - Client:10.20.11.203
    ...
    ...
    2500 more records
    I want to remove everything after the .aspx to keep only the part of the URL. for example:
    http://somepath/somepath/somepath/somepath.aspx
    http://someotherpath/someotherpath/someotherpath/someotherpath.aspx
    ...
    ...
    Thanks in advance for your help

    Slight modification of the position of Bravid

    with user_log as
    (   select 'http://somepath/somepath/somepath/somepath.aspx form visit at:prod - Client:10.10.101.243' ERRMESSAGE from dual union all
        select 'http://someotherpath/someotherpath/someotherpath/someotherpath.aspx form visit at:prod - Client:10.20.11.203' ERRMESSAGE  from dual
    )
    SELECT
        SUBSTR(errmessage,1,INSTR(errmessage,'.aspx') + length('.aspx') ) trimmed_errmessage
    FROM
        user_log
    /
    
  • How to extract the corresponding regex string

    Hello

    I am trying to extract text from a long string using QRegEx. Here's my regex:

    Rx QRegExp ("^. *(192|210). * key =? *");

    QString url = ""https://192.168.1.10/files/30/encrypt/key=s6h779bf " "

    rx.setPatternSyntax (QRegExp::Wildcard);

    rx.indexIn (str, 0);

    qDebug()<>

    qDebug()<>

    However, it is does not match anything.

    If I change the regular expression of "(192|210)." * key =? ' * ' can he match but I can't get the string after the = key

    You use a regular expression capture if you want that the parameter "key."

    QRegExp rx("^.*(192|210).*key=(.*)?");
    
    qDebug() << rx.cap(1);  // here's the first octet of your IP
    qDebug() << rx.cap(2);  // key parameter (optional)
    

    Your regex could do with a lot of improvement in my humble opinion. You might want to consuder the class QUrl that does what you want already:

    QUrl url("https://192.168.1.10/files/30/encrypt/key=s6h779bf");
    
    qDebug() << url.queryItemValue("key");
    

    Tip: rubular is a handy Tester on the regex web which makes this kind of thing much easier to debug

    http://rubular.com/

  • ghettoVCB extract missing after restart

    Hello

    can someone help me with this problem, I used and followed this document ghettoVCB.sh - free alternative for the backup of the virtual ESX (i) 3.5 and 4.x + machines - last updated 14/03/2011 to set up n schedulling for my VM Server backup. After completing the configuration, I tried to backup using the list and it is successful. Then I try to program using crontab, everything is ok until I have restart the server after restarting, I noticed that all the files and folders that I had created and configure disappeared... I hope there is someone out there can help my problem here...

    Hello

    Changes or the location of the files in ESXi are not preserved through reboots that ESXi is loaded into memory. Only some configuration files are saved via cron, to changes to preserve as cron, you will need to run the script to auto - backup.sh which is documented in the documentation of ghettoVCB. It is also recommended to place scripts ghettoVCB and the configuration files, the local or shared data store, where they will be persit by restarts.

  • Extract numbers from a string

    Hello
    i'numbers in the neck of string arrecnote

    Please help me in this...

    Published by: smile on October 7, 2010 05:33

    Published by: smile on October 7, 2010 06:14

    Try this to extract the numbers from a string:

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'hello-cycle monthly settlement;  865.15 SDR
      2  
    multilat net 218.15 (USD) USAWW-USACC-2007/10' col1 from dual) 3 SELECT * FROM 4 (SELECT REGEXP_SUBSTR(col1,'[0-9]+.[0-9]+',1,lvl) col1 FROM 5 (select col1,level lvl 6 from t 7 connect by level <= LENGTH(col1) - LENGTH(REPLACE(col1,' ')) + 1)) 8* WHERE col1 IS NOT NULL SQL> / COL1 -------------------------------------------------------------------------------- 865.15 218.15 2007/10 SQL> -- or if you just want the numbers with its decimal SQL> ed Wrote file afiedt.buf 1 with t as (select 'hello-cycle monthly settlement; 865.15 SDR 2
    multilat net 218.15 124 (USD) USAWW-USACC-2007/10' col1 from dual) 3 SELECT * FROM 4 (SELECT REGEXP_SUBSTR(col1,'[0-9]+[.][0-9]+',1,lvl) col1 FROM 5 (select col1,level lvl 6 from t 7 connect by level <= LENGTH(col1) - LENGTH(REPLACE(col1,' ')) + 1)) 8* WHERE col1 IS NOT NULL SQL> / COL1 -------------------------------------------------------------------------------- 865.15 218.15 SQL>

    Published by: AP on October 7, 2010 05:43

  • extract characters from a string

    Hi gurus,
    I want to extract the first, third, fifth, seventh... characters in a string.
    not to extract characters from a subset of characters in a select query in oracle 9i database.

    for example (1):
    Assume that a string like this "SUE" is that I am 'ACEGI"of the source string
    and the source can be any valid string, I just give an example here.

    Example (2) of "kalpataru' in klatau'

    Please guide me for this

    for 9i:

    SQL> with t as (
     select 'ABCDEFGHIJ' str from dual union
     select 'kalpataru' from dual
    )
    --
    --
     select str,
            trim(extract(xmlagg(xmlelement(e, substr(str,level,1)) order by level),'//text()')) str2   from t
      where mod(level,2) = 1
    connect by level <= length(str) and prior str = str and prior sys_guid() is not null
      group by str
    /
    STR        STR2
    ---------- --------------
    ABCDEFGHIJ ACEGI
    kalpataru  klaau         
    
  • to extract the value of string only

    Hello

    I have a column whose value is as
    Column A
    13 abc ert
    1 erf dfr
    28 aws erf

    Now what I want to extract only a string value. It can be a space or not.

    How to do this?

    Thank you

    Published by: user13305573 on July 28, 2010 20:32

    Hello

    This should do the trick for you.

    select trim(translate('12 abc ert', '0123456789', ' ')) from dual
    

    replace any string of your choice instead of ' 12 abc ert' in this statement.

    If it solves your problem, please check the question as answered so others do not waste their time reading of messages that already have solutions.

    Thank you

    John.

  • XPath in BPEL: how to extract message type to string

    Hi all

    I'm trying to extract all the contents of a special message type to a string. The special message is really simple XML.
    However, I would like to convert the special domain specific message in a string to be sent to an another partnerlink.
    I thought it might be a simple question of the use of an entitlement / copy operation by using the special message and function ora: getContentAsString.
    It does not :-(
    I get the following error in the log of the domain:

    ORABPEL-05002

    Handle error message.
    An exception occurred while trying to process the message 'com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessage '; the exception is: cannot execute XPath expression.
    Error while processing xpath expression, the expression is ":getContentAsString(bpws:getVariableData('businessEventBody')) ora", the reason is FOTY0001: type error.
    Please check the xpath query.

    Anyone have any ideas on how to solve this problem?

    Kind regards
    Aagaard

    I tried to get the content of a variable with a type of message.
    It fails with the same error that you mentioned.

    I tried again to get the payload content the type of message using bpws:getVariableData('_ ', '') _ _and_it_passed_through.)
    I still don't know why it fails for one another.

    Kind regards
    Srini.

  • Can not recover my laptop. Extraction, failed after 30%

    I tried to restart my system with the Toshiba product recovery disc that it usually goes past the first disc, and my laptop shuts down for any reason any. I left it half a year and thought that I try it once again and now when I do it gets like 30% of the first disk and then bed ERROR! Extraction failed.

    I tried on and new cleaning of discs and laser but I can t seem to be able to work, could someone please help me as soon as possible?

    Thank you
    Abbie

    Hi Abbie,.

    The usual cause of unexplained power thresholds is overheating. Verify that you do not have a build-up of dust and lint in your computer laptop cooling system.

    Restore the operating system recovery CD tends to produce a lot of heat from the drive hard although not too much CPU. If your device has not been used for 6 months, then it is possible that the hard disk does not work quite as well once. I can only suggest you persevere.

    Kind regards

  • BlackBerry Q10 Q10 forget everything after reboot

    Hello world!

    I've lived a very odd behavior on my Q10. After I updated to 10.3.2.2474, each new entry (contact, chat, e-mail... account all) endangered at each reboot. So, it seams, that only these data are etched in memory, who had already, before the update.
    Please help me, because I did not find any info on this problem!

    Thank you in advance!

    Hello!

    Welcome to BlackBerry Support Community!

    You can try the below the article. It might solve your problem you encounter on your device.

    http://support.BlackBerry.com/kb/articleDetail?articleNumber=000036747

  • SQL query to extract portions of a string.

    Guys,

    Please help me with a SQL to retrieve < PCS_NAME > and < PCS_ID > of the input below string:
    SAB_20140306145347_ 1307928540_avn1omcr_dot_com_14_20110612.csv

    The format of the string is:

    SAB_ < CollectDateTime > _ < EMS_timestamp > _ < PCS_NAME > < PCS_ID > _ < startdate > .csv

    < PCS_NAME > = "avn1omcr_dot_com."

    and

    < PCS_ID > = "14".

    Thank you!

    B

    Maybe this:

    WITH T AS

    (

    SELECT 'SAB_20140306145347_1307928540_avn1omcr_dot_com_14_20110612.csv' double str

    )

    SELECT REGEXP_REPLACE(str,'SAB_\d{14}_\d{10}_(.+)_\d{2}_\d{8}.csv','\1') as PCS_NAME,REGEXP_REPLACE(str,'SAB_\d{14}_\d{10}_(.+)_(\d{2})_\d{8}.csv','\2') PCS_ID

    T

    PCS_NAME PCS_ID

    ---------------- ------

    avn1omcr_dot_com 14

  • I can't extract PDF after DC pro update.  Any cure?

    Previously, I clicked on Pages organize and seen extracts on the side toolbar and there.  Now, when I click on organize Pages, I am taken to the interenet where I'm supposed to buy something that I have already!

    Help.

    Hi Jonathan,.

    I'm sorry to hear that you've been stuck in a loop. If you have previously subscribed to a different product (Acrobat Standard DC, for example)? If Yes, you can try to uninstall your Acrobat software, then reinstall of here. If this is no help, please reply to this thread and let me know - we will take it from there.

    Thank you!

    Rebecca

  • Extraction of numbers, no strings of text entry fields?

    Hello

    I have two input boxes that I can type numbers in.  I would like a third entry check box to show the total of the first two.

    I set up a listener to button on the stage to perform a function that adds together when a key is pressed.

    It comes, he puts just the strings together - it ddoesn can't add them

    So, how can I tell Flash that box1.text and box2.text are numbers?

    Box3.text = box1.text + box2.text is not doing.

    Thanks for your time.

    Shaun

    Hi celebrities music

    You will need to get the string to a number.  Something like:

    var firstNumber:Number = Number (box3.text);

    var secondNumber:Number = Number (box2.text);

    answer: var number = firstNumber + secondNumber;

    Of course, you want to make sure that the text in the text field is actually a number and someone was not able to type in a Word.  The best way to do it is NOT to do the textfield a text entry field.  Instead make a dynamic text field and give it a MouseEvent.CLICK event listener.  When someone clicks on the dynamic text input field, bring up a keyboard that requires them to enter the number in this way.

    I have an application exactly like this one where students had to enter a number in a text field to understand the econ issues.  The workflow has something like:

    1. Click the dynamic text field
    2. Bring up the Enter key digital
    3. When the user clicks on a number on the keypad, text matching using a switch statement
    4. Add numbers to text in a string field, that way someone who, between '1', '3' '8' will get 138 and not 12.
    5. With each press of button, update the dynamic text field to show what the user enters
    6. With the user presses the Enter key, then mount this text field in number and store it in a variable of type number

    Hope that helps.  Let me know if you need help with the code for one of these steps.

Maybe you are looking for