How Peel the string by using a simple query

Hi gurus,

I have a table with the following values

Machine of CREATE TABLE (Serial_number VARCHAR2 (20));

INSERT INTO values of machine ("THE S0001-00'");

INSERT INTO values of machine ("CA-C0001-00'");

INSERT INTO values of machine ("S0002-00'");

INSERT INTO values of machine ("S0003");

commit;

How to peel on any string before and after '-' as appropriate including the character '-', so that the result will be

S0001

C0001

S0002

S0003

Kind regards

efends

Hello

fendy_chang wrote:

Hi Frank,.

It works, but how to do using regular expressions.

In fact, I am creating an index of feature based on the skin of a String in order to join other table instead of using as a condition.

Kind regards

efends

Here's a way to do this with regular expressions:

SELECT Serial_number

REGEXP_SUBSTR (Serial_number

, CASE REGEXP_COUNT (Serial_number, '-')

WHEN '(.*) THEN 0'

WHEN 1 '(.*) CAN -"

ELSE "-([^-]*)"-

END

1

1

NULL

1

) AS the core

OF the machine

ORDER BY Serial_number

;

However, if it's a good idea to this part of the index, why isn't a good idea to store the serial number in 3 columns separated all along?  Database are designed to work with (at most) 1 piece of information in each column of each row.  Looks like you got a variable number (1, 2 or 3) of items all crammed together in 1 chain.

Tags: Database

Similar Questions

  • How XPoweredByHeaderLevel the value None using wlst

    How XPoweredByHeaderLevel the value None using wlst (default value is SHORT).

    I mean, I created a domain using wlst.
    Now, I want to put some XPoweredByHeaderLevel of WebAppContainerMBean votes to ZERO using wlst.
    It will be useful if an example of python (Jython) script is provided.

    Help, please.

    Here is a small example of Jython how to do what you want:

    #assuming you already have correct imports for wlst module

    #connect to the AdminServer using the appropriate authorities and host information

    WLST. Connect (username, password, host_info)

    domain #extract
    domainName = wlst.domainName

    #start change a session and navigate to the WebAppContainerMBean

    WLST. Edit()
    WLST. CD ("/WebAppContainer/" + domain name)
    wlst.startEdit)

    #set attribute to the value of the XPoweredByHeaderLevel to 'NONE '.
    wlst.cmo.setXPoweredByHeaderLevel ("NONE")

    #activate change
    WLST. Activate()

  • How to insert multiple lines using a single query

    Hi all

    How to insert multiple lines using a single query to the emp table?
    I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.


    Thank you
    Sunil

    Like this?

    SQL> create table test(id number , dt date);
    
    Table created.
    
    SQL> insert into test values(&a,&b);
    Enter value for a: 1   --- It asked me and I entered 1
    Enter value for b: sysdate  --- It asked me and I entered sysdate
    old   1: insert into test values(&a,&b)
    new   1: insert into test values(1,sysdate)
    
    1 row created.
    
    SQL> 
    

    g.

  • How does the predator AG3 used together the 128 GB ssd and hard drive 2 TB

    I am considering buying a predator AG3 at Costco.  It comes with a 2 TB HDD and ssd 128 b.  How the system is used both in combination?  The ssd is only for boot?  Windows will be on the SSD.  The system will know to go on the HARD disk for programs not on the SSD drive?  I have no experience using a system with two disks of a different type.

    SSD is usually used as installation of the OS and some heavy load programs (editing - audio - video)

    HARD drive is used as data storage or install programs of large size (for most games).

    System does not know where you want to install it that way, he asks during installation

    example of

    C:\Program Files\gamenameXYZ

    You can tell the installer to use instead of C: on SSD HARD drive, so you will change from C to D (if your HARD drive is D: letter of the system)

    D:\Program Files\gamenameXYZ

  • How to know the status of the process flow using a SQL query

    Hello
    I want to know the final status of a process flow after execution by using a sql query?

    The available entries are:
    -Item_Key
    -Process_Flow_Package_Name
    -Process_Flow_Name

    I ran the process flow using a WF_Engine.LaunchProcess ()procedure, but I was not able to know the status of the process flow.


    Is it possible to know the status of the process flow?

    using a procedure or an sql query?

    Thanks in advance,
    SriGP.

    Once the process is completed, or not, you can see the status by calling:

    UAS (your_OWF_shema) .wf_engine. ItemStatus()

  • How convert the string in enum by using LabVIEW 7.0

    I learned LabVIEW 8.6, but here at work, so we must use the Solaris workstations built in 95, the more advanced version of LV they will work is version 7.0.  On LV8.6, it was very to change a string to an enum using the format 'text' vi.  On LV7.0, is not available.  I made my own conversion from type vi with a structure of the case, but this is very annoying, because every time I add an element to the enum, I must add something to this vi.  I added the verification code so there is a warning if I add to the enum, but don't forget to update of the conversion of the vi errors.  Is it possible to reproduce the "text format" vi, using LV7.0?

    The analysis of primitive string will do the job in LV7.0.  Its a darn good idea to create a control of the enum type-def you use! If the constant and the witness are instances of your type definition, when you change the control (add, delete, rename, swap values) you can press the button to change to apply and PRESTO all your commands, constants and indicators that use the def type are updated with new info.

  • How to check the windows build the string by using the registry on windows 7?

    I would like to get my rope of construction of windows 7 Windows in the registry, can someone tell me where is it located? Thank you.

    Take a look at this place: HKLM\SOFTWARE\Microsoft\DataAccess\Version

    You may also save this code as a .vbs file. When you double-click it, and then you get some numbers you are after. What do you really want to?

    Set oWMIService = GetObject("winmgmts:\\.\root\CIMV2")
    Define cItems = oWMIService.ExecQuery ("" SELECT * FROM Win32_OperatingSystem ", 48")
    sResultat = «»
    For each oItem in cItems
    sResultat = sResultat & "Version:"& oItem.Version & \n ".
    sResultat = sResultat & "SerialNumber:"& oItem.SerialNumber & \n ".
    sResultat = sResultat & "BuildNumber:"& oItem.BuildNumber & \n ".
    sResultat = sResultat & "caption:"& oItem.Caption & \n ".
    sResultat = sResultat & "OSProductSuite:"& oItem.OSProductSuite. "
    Next
    MsgBox sResultat

  • bougth a second hand iPhone 6 how find the previous owner using the serial number?

    I bought a second hand iPhone 6 and he holds a lock to iCloud how to find the previous of this iPhone owner so that I can email him?

    I don't have a serial number of the phone how to use it so that I can follow the former owner?

    Unfortunately, you can not. Take it to where you bought it for a refund.

    See you soon

    Pete

  • CHD: the string is used as an index of change in data type? String to double?

    Hello

    I'm new to the tiara. I'm reading the line of a channel number and then to read the data of a channel which is in the same line of another channel.

    That's why I use the SMC function but my index seems not to fit. What I need to change in the code?

    error:

    CHD (2, NOVALUE): = 785 wird die Textvariable «...» CHD (2, > N)

    Code:

     

    DIM intloop, zeilenwerte
    Line DIM, aktwert, index
    Call ChnAlloc ("zeilenwerte", lang, 1, DataTypeFloat64) ' Create channel, 'lang' is the size of a channel
    index = 0
    index = 1 to lang
    index = index + 1
    aktwert zeit (index) = ' get the value that will be compared to the SOPS in the following line of code
    Line = PNo (myChannel, aktwert) ' it returns the line only by comparing aktwert valued myChannel
    CHD (line, zeilenwerte) = intloop ' <--->here the error. try to get the value in a line @index do String data types does not match? what do I do then?
    Next

    Thank you very much for your help!

    Buddhist salvation,

    It seems to me that you would be better to use "Linear Mapping" in the palette of ANALYSIS "Suitable curve", but you should be able to get your code works by passing the name of the channel in this second parameter instead of an empty string variable.  You would have noticed that if you had OPTION EXPLICIT the first line of your code - always a good idea.

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • How if the string

    Hello

    Is there a string of length 45, I want to display up to 35 characters on the window how we do this?

    SUBSTR (one_string, 1, 35)

    SY.

  • How did the key product used to identify the product? What is an electronic process or a human identification?

    When an authentic product is installed on the hard drive of a computer, it will still work as a true or as a product of infringement if the hard disk is transferred to another computer?
    What a case when the hard drive breaks down and is replaced by another? If the product is then installed in the hard drive replaced with the same product key that has been installed on the hard drive has crashed, it'll still work as genuine or a forgery?
    Hi Tom Bom - Pam,.
     
    -What version of the operating system are you using?
    -Which is the product that you are talking about? It's the operating system or any software/application?
     
    Product key is an electronic identification process.
     
    When an authentic product is installed on the hard drive of a computer, it will run as a genuine product for the hard drive and not the other hard drive.
     
    -What about a case when the hard drive breaks down and is replaced by another?
    If a product is installed in the hard drive replaced with the same product key that has been installed on the hard disk crashed, it won't work as long as a copy is authentic.
     
    If you are referring to the genuine copy of Windows, read this:
    Genuine Windows is a recurring process that checks your product key to ensure that it is used with the material, he has been associated during activation. If the product key appears as not authentic or not valid, it is likely that the product key is used on another computer or is a counterfeit.
    For more information, see:

  • Build the string separated by commas in query with Expression box sub

    Oracle 10g on Windows XP

    Consider the following query:

    Select batch_id, tr state_tag_seq where request_type in (select case WHEN PX = 'RETURN' AND 'TRANSFER' |) «, » || "PUBLIC TRANSIT"
    WHEN PX = "RFT" THEN "TRANSIT".
    ELSE 'Invalid '.
    END
    OF THE DOUBLE
    ) ;


    In this case, PX is accepted to execution of the user interface.

    I'm having no rows returned (all valid lines matching in DB) for the following case assessment

    WHEN PX = 'RETURN' THEN 'TRANSFER '. «, » ||' Transit "(PX when is evaluated to 'RETURN')

    The application works well when it px IS estimated to be "PCR" (as the evaluated expression is just a string ('TRANSIT') single, not separated by commas, as in the other case)

    Hiow do rewrite this query, if it gives a correct result? In other words, I actually build the query string slot, which is assessed by the external when query clause.

    I think it might be a specific way to use quotes in my case expression, but I'm reaching an impasse. Any help is appreciated.

    Thank you
    SR

    You can try

    select batch_id, state_tag_seq
      from tr
     where request_type member of case
                             when px = 'RETURN'
                             then
                              sys.dbms_debug_vc2coll (
                               'TRANSFER',
                               'TRANSIT'
                              )
                             when px = 'RFT'
                             then
                              sys.dbms_debug_vc2coll ('TRANSIT')
                             else
                              sys.dbms_debug_vc2coll ('Invalid')
                             end
    
  • Choice of the message can be changed in the table of search results Simple query region?

    Hi friends,

    I have a Simple search query region in 11i.

    I created the SearchVO and bound to the query Table Region.

    I have two attributes MessageStyleText and a MessageChoice attribute in the simple search criteria.

    Search results show very well for all attributes.

    But when I search with the criteria of MessageChoice, in the table of results, this attribute MessageChoice is indicated as editable, display the drop-down list.

    I did this attribute ReadOnly = True but then it becomes readonly in search also. So this dosent help.

    I need to this drop-down list of MessageChoice be modifiable in the search criteria, but read in the table of results.

    Please help me with the resolution. Its kinda urgent.

    Would appreciate any help.

    Thank you

    Rajesh

    He solved.

    Added programmatically in code.

    Kept the attribute as MessageChoice in the query Table Region.

    Added to the controller

    ' Public Sub processRequest (pageContext OAPageContext, OAWebBean webBean)

    {

    super.processRequest (pageContext, webBean);

    OAM OAApplicationModule = pageContext.getRootApplicationModule ();

    OAMessageChoiceBean = processFlagMessageChoice

    (OAMessageChoiceBean) webBean.findChildRecursive ("AttributeId");

    processFlagMessageChoice.setReadOnly (true);

    }

  • Use INSTR to extract a piece of the string?

    The guys from morning and Happy Friday.

    I have a situation where I have to take advantage of the string by using a select statement.

    Here's the chain I have to get the content between the 2nd and 3rd backslash. So basically I have to extract marypoppins. Any ideas?
    C:\USERS\marypoppins\Docs\Specification
    Here's where I started... and I've fallen on trying to find the 3rd backslash. I can easily start the INSTR 4 because I know that he will always be "C:\". »
    select select substr(C:\USERS\marypoppins\Docs\Specification',
                                INSTRB('C:\USERS\marypoppins\Docs\Specification', '\', 4), .....) from dual;
    WITH abc AS
         (SELECT 'C:\USERS\marypoppins\Docs\Specification' a
            FROM DUAL)
    SELECT SUBSTR (a,
                   INSTR (a, '\', 1, 2) + 1,
                   INSTR (a, '\', 1, 3) - INSTR (a, '\', 1, 2) - 1
                  )
      FROM abc;
    
  • Reverse the string

    Y at - it another simpler way to reverse the string (without using the "Reverse String" function) using labVIEW in addition to that I have tried in this attached below VI?

    Thanx.

    Use string subset in a loop with the subset of string length is 1 and decrement the offset of the string Max Length to zero.

Maybe you are looking for