Putting variable in regexp_substr pattern returns nothing

I'm trying to create a function to simply extract positioned text from a string, ie I want the text in position two from string X with a pattern of ' - '. I want to create a function so it is simpler for the developers but regexp_substr doesn't seem to like it.
So I want a function like below to be executed, select text_extractor('ABC - DEF - HIJ',' - ',2) from dual; which would return DEF;
But regexp_substr doesn't like matching on ' - '. If I tell it to give me position 2, I get '-', and if I tell it position 3, I get DEF. It seems to work fine if the '-' is substritued with a ':'
ie
select regexp_substr('ABC - DEF - HIJ','[^ - ]+',1,2) from dual;
results
select regexp_substr('ABC - DEF - HIJ','[^ - ]+',1,3) from dual;
results
DEF
select regexp_substr('ABC : DEF : HIJ','[^ : ]+',1,2) from dual;
results
DEF
I would further like to make a function to wrap it in but it didn't work at all.
The following examples return nothing.
create or replace function text_extractor (p_text varchar2, p_delimiter varchar2, p_position number)
return varchar2
is
begin
return (regexp_substr(p_text,'^p_delimiter]+', 1,p_position));
end;
I've also tried
create or replace function text_extractor (p_text varchar2, p_delimiter varchar2, p_position number)
return varchar2
is
v_search_expression varchar2(2000);
begin
v_search_expression := '''[^'||p_delimiter||']+''';
return (regexp_substr(p_text,v_search_expression),1,p_position);
end;
But I get nothing. Any ideas?

When you do this:
select regexp_substr('ABC - DEF - HIJ','[^ - ]+',1,2) from dual;
results
-Your search string is a set of characters, so you are saying anything that is NOT a space or dash (or space again, but that's redundant). So the first match is ABC, the second match is "-" as that's the second non-space match, so that's why you get that. Probably what you want is to ignore the spaces and use the "-" as your delimiter, then just trim the spaces off after...
SQL> ed
Wrote file afiedt.buf
  1* select trim(regexp_substr('ABC - DEF - HIJ','[^-]+',1,2)) from dual
SQL> /
TRI
DEF
SQL>

Similar Messages

  • Web Services deployment error "Server returned nothing (no headers, no data)" and more

    I'm developing a large-scale VI with an associated web service VI in 2010 SP1. The "auxiliary VI" is responsible for data capture and analysis as well as communications and data storage. It is fairly large and communicates with the web method VI via network-shared variables [and I'm using the DSC module to allow event handling on the shared variables].
    I can build and deploy the web method VI just fine and it runs great. However, I need to communicate between the auxiliary and web method VI's, and it looks like I can't do that without including the auxiliary vi in the RESTful web service build [by the way, is there any way to do this with web service builds?]. When I added the auxiliary vi to the build, it built fine, but then during the deployment I got:
    "Server returned nothing (no headers, no data)"
    The next time I tried to deploy, I got a spurious NI Auth dialog per this KnowledgeBase article. Following the instructions for case 1 ["Application Web Server failure since last start"], I ran Services.msc and found that NI Application Web Service was indeed not running. I tried to restart the service but got this error:
    "The NI Application Web Server service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service."
    The KnowledgeBase article suggests restarting at this point and I did, but I still see the same behavior. So I really have a few questions:
    1. Is there any way to deploy a network-shared variable library across a deployed web service and local VI?
    2. What causes "Server returned nothing (no headers, no data)" upon deployment? A google search returned very little.
    3. What does this mean: "The NI Application Web Server service on Local Computer
    started and then stopped..." and what do I need to do to get my Application Web Server back up?
    [to heap on the pile... I tried to re-enable the Application Web Server from localhost:3580 and got an error. Then localhost:3580 went off-line also.]
    thanks!
    Solved!
    Go to Solution.

    Update.
    I noticed that the Application Web Server was trying to deploy the broken web service and was choking on it. There seemed to be no way to erase the .lvws originally created by the build. I could delete the deployment folder at $(WebServicesRoot)\UserServices\deployed\<Service Name>-<Globally Unique Identifier (GUID)> but it was recreated from the .lvws every time I attempted to restart the service.
    So I called NI and they pointed me to this directory [in XP]:
    C:\Documents and Settings\LocalService\My Documents\LabVIEW Data\WebServices\Standalone
    The .lvws was in this folder. I deleted it and now I can run the ApplicationWebService. Apparently this undocumented hidden file is a "not-quite-bug" that is recognized as needing a fix in upcoming releases.

  • SQL query for presentation variable in dasboard prompt returns no rows

    Hello,
    I have a query like below.
    SELECT "mysubjectarea"."my lookup table"."Name" FROM mysubjectarea.
    I use this query in an analysis and it gives the intended result.
    But when I use this to populate a presentation variable in a dashboard prompt it returns nothing.
    How can I troubleshoot it?
    Is there anyway I can trace it in a log?
    Do you have any idea as to what might be going wrong?
    I am on 11g .5 version
    Thanks,
    Badal

    OK. So you are saying that the below query doesn't return any records? I thought the returned values are not being set in the pres. variable.
    SELECT "mysubjectarea"."my lookup table"."Name" FROM mysubjectarea.
    In this case, check the backend db table whether this column has any records. IF backedn tables has records, then add this column in the criteria and click results. Check whether you are getting the same set of records. IF not then check whether any cache is there.
    Go to Administration-->manaage sessions--> it will show you the logical sql. there click on the show log. iit wil display you the physical query and also whether this query hits a cache or not.

  • My iphone 4 wont turn on. it justr randomnly turned off and i have tried to hold the home and sleep buttons for a minute and also tried to put it into recovery mode but nothing is working?

    my iphone 4 wont turn on. it justr randomnly turned off and i have tried to hold the home and sleep buttons for a minute and also tried to put it into recovery mode but nothing is working?

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    But... if the Device has been Modified... this will Not necessarily work.

  • Getting error after putting variable in select statement

    Hi All,
    Kindly help me with Pl/sql code
    here i'm trying to put variable in select statement ....
    I successfully put the Yr and Mnth ..but getting error for loop variable "i"
    Here i'm getting error that too because of " i" only-->TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
    Please find the full code below.
    Declare
    Yr number not null:=2010;
    Mnth varchar2(20) not null:='Jun';
    v_val number:=0;
    begin
    for i in 1..2 loop
    case i
    SELECT count(*) into v_val
    FROM DUAL
    WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
    in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'))
    end case;
    end loop;
    end;

    Declare
      Yr number not null:=2010;
      Mnth varchar2(20) not null:='Jun';
      v_val number:=0;
    begin
      for i in 1..2 loop
      SELECT count(*) into v_val
      FROM DUAL
      WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
      in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'));
    end loop;
    end;

  • Why doesn't my card reader work when I take it from the camera and put it in the reader? Nothing happens and it doesn't show up in finder.

    When I put my card into the reader, nothing happens. It doesn't show up in finder so I can't dismount it. The pictures on it aren't readeable all of a sudden, except for two of them, and that's all that would download to iphoto, but I had to connect the camera since the card reader doesn't resond.

    Hi bricknut dab,
    Welcome to the Support Communities!  Are you asking about the SD slot on your Mac, or is this an external card reader plugged into a USB port?  If it is the one on your Mac, the article below may be helpful.  Did you try more than one SD card?  You can use Disc Utility to erase and reformat the card if needed.
    About the SD and SDXC card slot
    http://support.apple.com/kb/ht3553
    I put the card in the slot, but it did not mount.  What should I do?
    Remove the card and insert it again. Sometimes, if you put the SD card into the slot too slowly, it may not mount properly.
    Can I reformat an SD card with Disk Utility?
    Yes. Using Disk Utility, you can partition and format an SD device as FAT32 (using the MS-DOS FAT setting) or Mac OS Extended. The Mac OS Extended format can only be used on Macintosh systems. Cards formatted to Mac OS Extended will not be recognized by non-Apple systems. Formatting cards larger than 32GB for use with digital cameras, GPS, and other devices may require formatting them with the exFAT file system. When in doubt, format the cards in the device you intend to use with the card.
    Cheers,
    - Judy

  • User Profile -Purchasing -returns nothing

    I created a User Profile in Oracle Applications under -Application Developer
    Application :Purchasing
    User Profile Name: PO: SBM CHANGE
    Hierarchy type: Security
    SQL validation:
    SQL="select decode(meaning,
                   'Yes','Full',
                   'No','None') \"Access Level\",
              lookup_code
         into :visible_option_value, :profile_option_value
         from fnd_lookups
         where lookup_type = 'YES_NO'
    Now I am trying to run this query which returns Nothing. Is that because i have application level *Purchasing*
    {code}
    select apps.fnd_profile.value('PO: SBM CHANGE') from dual;
    {code}
    Thanks

    Hi,
    First you need to give values for that profile option (resp. System Administrator > Profile > System).
    Also, when using fnd_profile.value, you need to specify the internal profile option name, and not the user profile option name (maybe they are identical in your case?).
    And also, typically you need to specify your context before calling fnd_profile. You can use fnd_global.apps_initialize for that.
    Hope it helps.

  • Running 'netstatt' On An Interface Alias Returns Nothing.

    Hi all,
    can some one please shed some light on this behavior. We defined some network interface aliases on a SunOS machine. Running a 'netstat' on the alias returns nothing, while running it on the actuall device name returns the expected stats.
    Is this behavior by design?
    How can you get stats running this cmd on an alias interface name?
    Thank you

    It did not solve the issue. But I found it.
    I sketch what I've done .. maybe others can use that info too.
    Reason: For traditional reasons, we use Apache Configs for Aliases ... no mapping within CF itself because up to CF9 those mappings are global. Howerver, for UNC mappings, this seems to be the bad way.
    Up to today, I had no idea how Apache and CF talk to each other on paths. Obvioulsy, CF ask Apache for a path resolution, but Apache as a System Service, was not able to verify the accessibility of the UNC path. Therefore, it or CF figured that they use the webroot of this vhost.
    When I ran Apache as Administrator, it could access the UNC and therefore Apache and/or CF returned the correctly expanded path. Of course, we don't run Apache with more rights than the System Service. Resetting Apache to that also returned the wrong UNC expansion.
    So, we now go with Mappings in CF itself. Since CF 10 allows for Per App Mappings, this is no longer a problem.
    Martin

  • Hsodbc returns nothing :::Plz Help me :)

    Hi to all,
    I try to connect Oracle DB to Mysql database. I did these steps :
    1- Testing MySQL ODBC Driver using isql => Works fine
    2- Configuring the HSODBC process , my listner.ora file contains these entries :
    # listener.ora Network Configuration File: /u01/app/oracle/oracle/product/10.2.0/devxen03/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u01/app/oracle/oracle/product/10.2.0/devxen03)
    (PROGRAM = extproc)
    (SID_DESC =
    (PROGRAM = hsodbc)
    (ORACLE_HOME = /u01/app/oracle/oracle/product/10.2.0/devxen03)
    (SID_NAME =my_client)
    (ENVS = "LD_LIBRARY_PATH=/u01/app/oracle/oracle/product/10.2.0/devxen03/lib32:/usr/lib:/u01/app/oracle/oracle/product/10.2.0/devxen03/hs/lib32")
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = devxen03.es.el.lan)(PORT = 1521))
    when I tried; hsodbc in command line : nothing comes back from this command
    Any idea please? I(m working on Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on linux redhat server.
    Thanks a lot,
    Edited by: OracleJavaLinux on Dec 1, 2009 3:20 PM

    Thanks ora-dba;
    it means returns nothing without errors;
    But strange I got erros when I execute the command below, any idea? :
    *[root@devxen03 ~]# strace /u01/app/oracle/oracle/product/10.2.0/devxen03/bin/hsodbc*
    *execve("/u01/app/oracle/oracle/product/10.2.0/devxen03/bin/hsodbc", ["/u01/app/oracle/oracle/product/1"...], [* 26 vars */]) = -1 ENOEXEC (Exec format error)*
    dup(2)                                  = 3
    fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
    *fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0*
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a95557000
    lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
    write(3, "strace: exec: Exec format error\n", 32strace: exec: Exec format error
    *) = 32*
    close(3)                                = 0
    munmap(0x2a95557000, 4096)              = 0
    exit_group(1)                           = ?
    *[root@devxen03 ~]# echo $?*
    *0*

  • My ipod touch 4g is frozen wont turn on or do anything just black ont register with the computere either ive put it in dfu mode n nothing happens plz help

    my ipod touch 4g is frozen wont turn on or do anything just black ont register with the computere either ive put it in dfu mode n nothing happens plz help

    See Here for
    iOS: Not responding or does not turn on
    Frozen or unresponsive iPod touch

  • SQL LIKE Operator return nothing

    I am working on an intranet application and use Access as the
    database.
    There is a query that I have
    <CFQUERY DATASOURCE="#DSN#" NAME="GET_SEARCH_RESULT">
    SELECT * FROM WL_TREES
    WHERE TREENAME LIKE '3*'
    </CFQUERY>
    It returns nothing in ColdFusion, if I copy just the SQL and
    run it in Access, it returns with the expected result.
    Any idea why ColdFusion query didn't work?
    Thanks,
    tofuTnT

    replace the * with a % and you should be good to go.
    HTH
    Tim Carley
    www.recfusion.com
    [email protected]

  • CRM search, request return nothing

    Hi,
    When I try to make research in our b2b applications (CRM 5, TREX 7 update26) if I use the character "*" it return all items, but any other character, (join, union) returns nothing for any requests.
    I have the following error : "An exception has occurred: Invalid attribute "TEXT_0001" in the filter printout  Invalid attribute "TEXT_0001" in the filter printout.
    com.sap.isa.catalog.impl.CatalogBuildFailedException: Invalid"
    (SRM0, RFC connections works fine, catalog is well replicated)
    The Quick Search Attributes from the WEB-INF/cfg/catalog-site-config.xml was not be modified.
    Any Help will be reward.
    Regards,
    Thomas

    This reply is way too late, but might help someone.
    There are two options in your case:
    1. Attribute "TEXT_0001" is not replicated in TREX catalog
    2. "TEXT_0001" is in P-Index, and you are doing search over the S-index (or vice-verse).
    There are 2 types of Queries in ISA.
    Catalog search which is done over the P-indexes (when you create your Quesry throug the ICatalog object).
    Category specific search which is done over the S-indexes (when you get your Query from a ICategory).
    Best regards,
    Marian

  • Unable to put  Reason for Rejection for Return Sales Order

    Hi
    I am unable to put  Reason for Rejection for Return Sales Order.
    what may be the reason?
    Reg,
    Antaa21

    hi
    One of the possible reson could be, there is subsequent document created. Please check the VBFA table for document flow and see if there is any other document created for this line item, if yes then you have to reverse the same
    Check whether this field is maintained as DISPLAY only or not
    T-Code SE51(Screen Painter)
    Give Program Name SAPMV45A
    (before doing this confirm from the field from sales order, keep curcer on the pricing date press F1
    and then select technical details)
    Screen Number 4441
    (before doing this confirm from the field from sales order, keep curcer on the pricing date press F1
    and then select technical details)
    Select Attributes radio button.
    Go to Element list Tab. Inturn select Special Attribute tab in Subscreen.
    For Field Name "VBAP-ABGRU" Check what is maintained might be it is maintained as DISPLAY only.

  • How to print - when query returns nothing

    Hi All
    I have query...
    select sum((sum(nvl(ac.amtsourcedr,0))-sum(nvl(ac.amtsourcecr,0)))) as balance
    from fact_acct ac
    where ad_client_id=1000000
    and dateacct < '1/04/2010'
    and ac.account_id=1000432
    group by  ac.account_id
    I want to print zero when query returns nothing
    how to do that ..???
    thanking you in advance
    Regards
    gaurav

    use NVL
    select nvl(sum((sum(nvl(ac.amtsourcedr,0))-sum(nvl(ac.amtsourcecr,0)))),0) as balance
    from fact_acct ac
    where ad_client_id=1000000
    and dateacct < '
    and ac.account_id=1000432
    group by ac.account_idAnd yes you need to remove the Group By as stated by Toon, forgot to mention it
    Edited by: Karthick_Arp on May 27, 2010 4:04 AM

  • My MacBook Pro, 15 inch, purchased in 2006 may have a virus or perhaps has crashed.  When I power it up, I get strange patterns.  Nothing else loads.  Is this a virus or has the hard drive crashed?  Thanks.

    When I power up my MacBook Pro, I get patterns.  Nothing loads.  Has my hard drive crashed or do I have a virus.  I had been burning a DVD from an iMovie project on an external hard drive when problems began.  Thanks for any insights.

    Sounds like the video card is going, mine did that after I installed the P.O.S . OS X called Lion.
    Was working fine under 10.6, little did I know that Cupertino was compromised at that time, likely the hackers corrupted the firmware updates.
    Take it in, they will run their little test and say it's the video card and it's not worth spending $350+ plus whatever else you need to fix it.
    Scrap it for parts and buy a new one.
    However, you can extract the hard drive and use a SATA to USB adpater cable to the new Mac, transfer files manually or use Migration/Setup Assistant.
    http://eshop.macsales.com/installvideos/
    you'll need a tool kit too.

Maybe you are looking for

  • How to configure thrid party listeners to JMS queu

    I have to design a BPEL process that publishes a message onto a topic. The subscriber to the topic is not another Fusion process, but an external, third part service. How do I do the configurations to register a subscriber to this topic. Allso, I wou

  • How to install Adobe Acrobat xi from a disk?

    Trying to install Adobe Acrobat XI Pro from a disk to a new MacBook Air laptop using a portable drive.  Prompts are not coming up.

  • How to get a variable into another block?

    Hello, (I am from Germany, so be patient due my english please) We do a project at our University where we have to do with wordfrequencies. The app works fine, but it cannot works with the variable wich contains the information to analyse. Look, I am

  • Simple question - Can I use a Mini Mac with a webcam to use facetime?

    Hello, I have a friend who wants me to use Facetime to call him.  If I have a Mac Mini with a webcam, can I use Facetime?  Also, how fast does the processor need to be?  Thanks in advance.

  • Catalog backup folders empty?

    I'm recovering from a crashed hard drive. All of my image files are restored and in place, now I've reinstalled Lightroom 3. The problem is that when I go to my catalog backup folders, they are all empty. There are dozens of folders that look like ba