Need to extract the global name

Hello

I'm working on 11 GR 2 on RHEL.

I am trying to extract the global name under the name of the comic.

For example: If the db name is sample and if global name is sample.london.uk.com so I only need london.uk.com

I tried to use something like REGEXP_substr (global_name, '[..] ([A-Z] * [0-9] * []] *---*'), but it does not work.

SQL> select global_name, REGEXP_substr(global_name, '[.][A-Z]*[0-9]*[-]*[.]*' ) gname from global_name;

GLOBAL_NAME                    GNAME
------------------------------ ------------------------------
SAMPLE.LONDON.UK.COM           .LONDON.
I want to extract LONDON.UK.COM

Any suggestions?

I want to extract LONDON.UK.COM

SQL> with global_name as (
  select 'SAMPLE.LONDON.UK.COM' global_name from dual
)
--
--
select global_name, regexp_substr (global_name, '\.(.*)',1,1,null,1) gname from global_name
/
GLOBAL_NAME                    GNAME
------------------------------ ------------------------------
SAMPLE.LONDON.UK.COM           LONDON.UK.COM
1 row selected.

Tags: Database

Similar Questions

  • Extract the first name and last names of a string

    Hello people,
    I am trying to extract the last name, first name, first name and initial of some names of students for a report. I have some success with the first name and the first names, but have some difficulty to come with the other two. I use Oracle 9i and would like to come with the SQL.

    Script to create the table:
    create table grad_student_tb
    (student_id varchar2(3) primary key,
     salutation varchar2(4),
     student_name   varchar2(60));
    Script to insert records into the table:
    Insert into GRAD_STUDENT_TB (STUDENT_ID,SALUTATION,STUDENT_NAME) values ('001','Mr','Adams,Robert Murphy');
    Insert into GRAD_STUDENT_TB (STUDENT_ID,SALUTATION,STUDENT_NAME) values ('002','Mr','Green,Eric Craig');
    Insert into GRAD_STUDENT_TB (STUDENT_ID,SALUTATION,STUDENT_NAME) values ('003','Miss','Brown,Jennifer William H');
    Insert into GRAD_STUDENT_TB (STUDENT_ID,SALUTATION,STUDENT_NAME) values ('004','Mr','Adams,Michael William H');
    Insert into GRAD_STUDENT_TB (STUDENT_ID,SALUTATION,STUDENT_NAME) values ('005','Miss','White,Snow');
    Here's what I would like on my report:
    Student ID   First Middle Name    Last Name   First Name   Initial
    ==================================================================
    001          Robert Murphy        Adams       Robert       M
    002          Eric Craig           Green       Eric         C
    003          Jennifer William H   Brown       Jennifer     W
    004          Michael William H    Adams       Michael      W
    005          Snow                 White       Snow
    Currently my SQL looks like this:
    select student_id,
           SUBSTR(student_name, INSTR(student_name,',')+1, LENGTH(student_name)) first_middle_name,
           SUBSTR(student_name,1, INSTR(student_name,',')-1) last_name
    from   grad_student_tb;
    Output:
    STUDENT_ID FIRST_MIDDLE_NAME                                            LAST_NAME                                                    
    ---------- ------------------------------------------------------------ ------------------------------------------------------------ 
    001        Robert Murphy                                                Adams                                                        
    002        Eric Craig                                                   Green                                                        
    003        Jennifer William H                                           Brown                                                        
    I need to come up with the first name and initial of the students.

    Any help is greatly appreciated!

    Thank you

    Published by: Roxyrollers on August 18, 2011 12:53

    Assuming that each name is exactly the same format

    SQL> ed
    Wrote file afiedt.buf
    
      1  select student_id,
      2         SUBSTR(student_name,
      3                INSTR(student_name,',')+1,
      4                LENGTH(student_name)-INSTR(student_name,' ')) first_name,
      5         SUBSTR(student_name,
      6                INSTR(student_name,' ')+1) middle_name,
      7         SUBSTR(student_name,
      8                INSTR(student_name,' ')+1,
      9                1) middle_initial,
     10         SUBSTR(student_name,1, INSTR(student_name,',')-1) last_name
     11* from   grad_student_tb
    SQL> /
    
    STU FIRST_NAME      MIDDLE_NAME          MIDDL LAST_NAME
    --- --------------- -------------------- ----- ---------------
    001 Robert          Murphy               M     Adams
    002 Eric            Craig                C     Green
    003 Jennifer        William H            W     Brown
    

    In general, of course, analysis names as it is much more complicated because you have to deal with the family as "la Hoya" names that contain spaces and cannot easily be distinguished from someone with several names.

    Justin

  • Extract the host name vCenter using PowerCLI

    Hi all

    I was asked to create a script that displays the host ESX, the version of the product name (I use "Get-View $_USER.USER"). «» ""Config.Product.FullName"), and what I thought, that's easy, vCenter host name." I'm having a hard time trying to figure out how to extract the host name real vCenter. I can get the vDC and the cluster, but I can't find what combination of cmdlets or vim commands can extract this nugget. Is something that is accessible via a standard cmdlet such as get-viproperty, get-view or another?

    TIA,

    g

    Does what you're looking for?

    Get-VMHost | Select Name,@{N="vCenter";E={$_.Uid.Split(':')[0].Split('@')[1]}}
    
  • Seek to extract the first name last name

    Hello everyone...

    Bit of a rush here but again, it's a forum.

    I need to get the name of the first single from a string.

    Example:

    Full name = Brown, Richard Ryan
    Full name = Green, Marie
    Full name = black, Joseph H

    I need to extract everything after the comma and the space before. So, my results should be:

    Name = Richard
    Name = Mary
    Name = Joseph


    Thank you very much!

    Like this

    SQL> with t
      2  as
      3  (
      4  select 'Brown,Richard Ryan' full_name from dual union all
      5  select 'Green,Marie' full_name from dual union all
      6  select 'Black,Joseph H' full_name from dual
      7  )
      8  select full_name, substr(full_name, instr(full_name, ',')+1, instr(full_name || ' ', ' ') - instr(full_name, ',')-1) first_name
      9    from t
     10  /
    
    FULL_NAME          FIRST_NAME
    ------------------ ------------------
    Brown,Richard Ryan Richard
    Green,Marie        Marie
    Black,Joseph H     Joseph
    
    SQL>
    
  • Extract the attribute name (s) (not) - how to?

    version: 11.2.0.4 (standard no company)

    context: determine all fragment a (e) xml attribute names.

    Table ddl (just a shadow table for unit tests):

    CREATE TABLE FAR_XML
    (
      REQUIREMENT_ID  NUMBER,
      FAR             SYS.XMLTYPE
    )
    XMLTYPE FAR STORE AS SECUREFILE BINARY XML
    

    sample:

    <F_A_REQ>
      <RULES>
        <VALUE KEY="FADEF_PRESENT"><![CDATA[E239]]></VALUE>
        <VALUE KEY="FADEF_SECTIONS"><![CDATA[1.2]]></VALUE>
        <VALUE KEY="FADEF_DEFINITION"><![CDATA[E257]]></VALUE>
      </RULES>
    </F_A_REQ>
    

    question: How can I query a table with an xmltype column (not placed on a diagram) and derive what the KEY 'names' are for a single record?

    desired output:

    FADEF_PRESENT

    FADEF_SECTIONS

    FADEF_DEFINITION

    Thanks in advance for any guidance.

    -abe

    For example:

    SQL> select x.value_key
      2  from far_xml t
      3     , xmltable('/F_A_REQ/RULES/VALUE'
      4         passing t.far
      5         columns value_key varchar2(30) path '@KEY'
      6       ) x
      7  ;
    
    VALUE_KEY
    ------------------------------
    FADEF_PRESENT
    FADEF_SECTIONS
    FADEF_DEFINITION
    
  • Need to know the instance name of window for Acrobat Reader XI

    I try to use a custom web program that launches Adobe Acrobat Reader XI and want to know the instance name for this version of Acrobat Reader window. I updated my version of Acrobat Reader 10.0 and the instance name of window seems to have changed, once again!

    This is the story of the instance name of the window for Acrobat Reader in case you don't know what I am referring. I tried all the supposed possible variation of what I expected it to be and all seem to fail. Adobe seems to have changed the name of the instance of the window.
    Also another note is that the new name of the server is "ACROVIEWR11" and it is the XI (11) version installed on a 64-bit computer to Windows 7, so who can make a difference.
    Any help would be greatly appreciated

    Acrobat Reader 10 - the window instance name = Acrobat
    Acrobat Reader 6 & 7 - the window instance name = Adobe Reader
    Acrobat Reader 5 - window instance name = Acrobat Reader

    Why not just use a reporting tool to find out?

  • Help needed to extract the pipe-delimited fields in a CLOB data type

    Hello

    I had a table with clob field as indicated below.
    CREATE TABLE TRANSACTION_INFO
    (
      TRASACTION_ID  CLOB,
      LOG_ID  NUMBER
    )
    
    Insert into TRANSACTION_INFO
       (TRASACTION_ID, LOG_ID)
     Values
       ('354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123);
    Insert into TRANSACTION_INFO
       (TRASACTION_ID, LOG_ID)
     Values
       ('354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456);
    COMMIT;
    As you can see the field Clob is a pipe delimited data. Now I'm able to extract the first two fields using the below querry. But it may be the right solution as
    SUBSTRING function fails if there is lack of character in all fields.
    Also when there is a null value in all the areas, how can I be able to get as a null value? Basically, I want to get the values in a defined way.

    How can we achieve this?
    Select Substr (TRASACTION_ID, 1, Instr (TRASACTION_ID, '|')-1) field1,
            Substr (TRASACTION_ID, 17, Instr (TRASACTION_ID, '|')+2) field2               
      From TRANSACTION_INFO;
      
    
    output should be like as shown
    
       FIELD1          FIELD2          FEILD3                 FEILD4
      
    354502002020910     000000610214609663                  09/27/09 08:02:37
    354599892020910     000000610214609663                  09/27/10 08:12:47
    Thank you
    Rede
    SQL> with transaction_info (trasaction_id, log_id)
         as (
     select '354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123 from dual union all
     select '354599892020910|||000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual union all
     select '|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual
    )
    --
    --
    select trim(regexp_substr (trasaction_id, '[^|]+', 1, 1)) f1,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 2)) f2,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 3)) f3,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 4)) f4,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 5)) f5
      from (select regexp_replace(replace (trasaction_id, '|', '| '),'^\|', ' |') trasaction_id from transaction_info)
    /
    F1                   F2                   F3                   F4                   F5
    -------------------- -------------------- -------------------- -------------------- --------------------
    354502002020910      000000610214609663                        09/27/09 08:02:37    RNEW
    354599892020910                                                000000610214609663
                         000000610214609663                        09/27/10 08:12:47    SOLD                
    
    3 rows selected.
    
  • Need space between the first name and family name

    Hi, I use Concat to join the first and last name, but I need a space between the two...

    Hello

    Try this concat (concat ('users'. "First name",""), 'Users' '. "" Family name")

    Kind regards
    Young

  • Need your advice - the user name and roles

    We are the OEM deployment within our Organization.  There is a special requirement on business unit to have several names for the same person, with different roles.    Which means 'employee_1' will be 3 id for several roles such as employee_1_Administrator, employee_1_Operator, employee_1_Monitor!    Is - this recommended by Oracle? or it companies set up such a system? (I know it's technically feasible, but I'm confused as it is a best practice).

    Any suggestions or pointers are really appreciated.

    Vijay

    No, it sounds like a recipe for chaos for me I recommend several ROLES by user.  But if you have several users, they will constantly be logged in and out based on what targets that they manage and which kind of defeated the purpose of having a "Enterprise Manager" tool in my opinion.

    The way in which users EM are roles assigned, allows you to provide multiple roles functionality that can easily be revoked should change responsibilities.

    So create 3 roles:

    Administrator

    Operator

    Monitor

    Give the 3 roles employee_1

    I'd be interested to hear the conditions for this... but the only case that I heard in other companies is for a small number of people who have administrator-level privileges.  UserA was UserA account + userA_Admin.  Must not use their account "admin" for normal each daily tasks (management db, work planning, etc.) but only when necessary for higher level privileges.   Again, it is possible, but difficult.   Only 1 of about 40 clients that I worked with it.

  • How to extract the directory name of the script

    I am currently working in the extendscript toolkit, how do I retrieve the name of the current script file so I can then get to "current working directory"? or do I have to hardcode it in dev?

    With the approach of try-catch, ESTK executing in the exception you want to enter the name of the file off the coast of the exception.

    try {}

    activeScript var = app.activeScript;

    } catch (ex) {}

    activeScript var = line (ex.fileName);

    }

    On the other hand, there is also. Filename $...
    Dirk
  • Extract the column names

    Hi all

    I have a requirement...
    I have a sql Query, something like this

    Select emp_code,
    emp_first_name | » '|| emp_last_name,
    substr (emp_addr, 1, 240),
    NVL(SAL,0) wages.
    emp_doj
    Of employee_master

    I want to divide the columns in a table of column_detail
    as
    column_id column_name
    1 emp_code
    2 emp_first_name | » '|| emp_last_name
    3 substr (emp_addr, 1, 240)
    4 nvl(sal,0)
    5 emp_doj

    Is it possible to do this... other than the weiring loooooooooooops that handles all the possible characters?

    Please, I beg you. help... Thanks in advance
    Concerning
    Dora

    Hello

    Use the DBMS_SQL package:

    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    
    SQL> set serveroutput on
    SQL>   -----------------------------------------------
    SQL>   --  Get data structure for any select order  --
    SQL>   -----------------------------------------------
    SQL> Declare
      2    c           NUMBER;
      3    d           NUMBER;
      4    col_cnt     PLS_INTEGER;
      5    rec_tab     dbms_sql.desc_tab;
      6    col_num     NUMBER;
      7    LC$Order    VARCHAR2(2000) := 'Select EMPNO, ENAME, JOB FROM EMP' ;
      8
      9    v           VARCHAR2(4000) ;
     10    t           T1 ;
     11
     12    result             INTEGER;
     13
     14    BEGIN
     15
     16      -- retrieve the columns of the query --
     17      c := dbms_sql.open_cursor;
     18
     19      dbms_sql.parse(c, LC$Order , dbms_sql.NATIVE);
     20
     21      d := dbms_sql.execute(c);
     22
     23      dbms_sql.describe_columns(c, col_cnt, rec_tab);
     24
     25
     26      For i in rec_tab.first .. rec_tab.last Loop
     27
     28        Dbms_Output.put_line('Colomn name:' || rec_tab(i).col_name ) ;
     29        --rec_tab(i).col_name ;      -- name
     30        --rec_tab(i).col_type ;      -- type
     31        --rec_tab(i).col_precision ; -- precision
     32        --rec_tab(i).col_scale ;     -- scale
     33        --rec_tab(i).col_max_len ;   -- length
     34
     35      End loop ;
     36
     37      dbms_sql.close_cursor(c);
     38
     39
     40    EXCEPTION
     41      WHEN OTHERS THEN
     42
     43        IF dbms_sql.is_open(c) THEN
     44           dbms_sql.close_cursor(c);
     45        END IF;
     46
     47        RAISE;
     48
     49    END;
     50  /
    Colomn name:EMPNO
    Colomn name:ENAME
    Colomn name:JOB
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    François

  • extract the names of waveform plot

    Hello

    Is it possible to extract the field names from a range of waveform to a new array that contains the names of the plot.

    Kind regards

    If you use the types of waveform data to update your plot, then you can iterate over all channels and remove the name attribute or,

    You can use a loop For who uses the terminal portion to drive the property "Active Plot" of the indicator, then pull the name using a second (preferably an extended property node) and let the names pile up in a tunnel exit for automatic indexing.

    Ben

  • Need to change the name of the server and the IP

    Hi Lion,

    I need to change the server name and IP address of my Test Server, because it is the replica of the server of Production, and because the name and IP are the same because of this problem I can't access it on LAN environment, for that I have to change the name and IP address of my Test Server so that I can use it in the LAN environment. Can any body me consequence after changing, and in which files I have to change the IP address and the name, I use Oracle Enterprise Linux.

    Kind regards

    Salvation;

    Please check:
    Change of IP address in 11i app
    Re: What changes must be made if the IP address of the Server 12 APPS is changed!

    It may be useful

    Respect of
    HELIOS

  • How to extract the XML with namespace?

    Hi all

    Here's the XML I:

    <? XML version = "1.0" encoding = "UTF-8"? >
    -< transaction xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns = "http://schemas.test.com/Support/Services/test1/2012" xsi: schemaLocation = "http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd" >
    -< application >
    < > 10 Sam < / Sam >
    < > 32 Actid < / Actid >
    < Pax > 3 < / Pax >
    < > 10 - DEC - 2012 Flt < / Flt >
    < user name > WebUserNameTest < / name >
    < / request >
    < application >
    < Sam > 1 < / Sam >
    < Actid > 3 < / Actid >
    < > 2 Pax < / Pax >
    < Flt > 2012 - dec - 12 < / Flt >
    < user name > WebUserNameTest < / name >
    < / request >
    < / transaction >

    I need to extract the item values:

    The code below will help me when I have no namespace, what needs to be done in order to work with the value of the element namespace and etract

    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Sam / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .memid: =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();


    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Actid / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .actid: =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();

    v_string_xml: =.
    ' / / Query [']
    || To_char (counter_xml)
    || '] / Pax / text () ';
    v_ssp_table (v_ssp_table..) Pax COUNT): =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();

    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Flt / text () ';
    v_ssp_table (v_ssp_table..) Flt COUNT): =.
    p_xml_in. EXTRACT (v_string_xml) .getstringval ();

    v_string_xml: =.
    ' / / Query [']
    || To_char (counter_xml)
    || '] / Username / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .username: =.
    p_xml_in. EXTRACT (v_string_xml) .getstringval ();
    declare
      v_xml xmltype := xmltype( '
    
    
    10
    32
    3
    2012-DEC-10
    WebUserNameTest
    
    
    1
    3
    2
    2012-DEC-12
    WebUserNameTest
    
    ' );
    begin
      for r_xml in ( select *
                     from xmltable( xmlnamespaces( default 'http://schemas.test.com/Support/Services/test1/2012' )
                                   , '/Transaction/Request'
                                   passing v_xml
                                     columns memid number path 'Memid'
                                           , actid number path 'Actid'
                                           , pax number path 'Pax'
                                           , flt varchar2(100) path 'Flt'
                                           , username varchar2(100) path 'Username'
                                  )
                   )
      loop
        dbms_output.put_line( r_xml.memid );
        dbms_output.put_line( r_xml.actid );
        dbms_output.put_line( r_xml.pax );
        dbms_output.put_line( r_xml.flt );
        dbms_output.put_line( r_xml.username );
      end loop;
    end;
    
  • Help! I need to extract audio from a video to an audio file in my HARD drive

    Hello

    I have a project that needs to me mastered (the audio part at least), and I need to extract the audio parts of my sequence in 'physical' files on my HARD drive, so I can load my project (with these separate audio files) on another computer where the control will be done... but I can't do it! .. is there anyway I can do this?

    Help, please!

    Thanks in advance...

    Al

    You can select an avi clip and right click, then choose Edit in Soundbooth. This creates a wav audio file in the clip, with the same name as the video clip with "extract" added automatically.

    Also, it replaces the audio in the sequence with the extracted file, but does not change the original item.

Maybe you are looking for