Variable field in a VARCHAR2 column separator

I need to extract a part of a value into a VARCHAR2 (50 BYTE). The data layout is like this Field1/Field2. The position of the partition field is not always the same on all the records, but the separator character is always the same. How would you suggest that I can do this? I only need the value of FIELD1.

Thank you in advance,
JB

Use the builtin SUBSTR and INSTR functions

Tags: Database

Similar Questions

  • Need for clarification to varchar2 column

    I get xml that will be inserted in the local table messages
    It is, I don't really know the size of the incoming xml message data.
    Design of the structure of the table is now difficult.
    If I design the column in the table for column varchar2 with VARCHAR2 (4000) and if the message contains the value
    as 'SAM', 'GEORGE' (no more than 10 characters) then it does not seem good for the VARCHAR2 COLUMN (4000)
    Oracle does not create the table with VARCHAR2 (without specifying the size)

    Any suggestions?

    S

    There's no real difference if you use varchar2 (4000) or varchar2 (100). Apart from the obvious that you can store up to 4000 bytes, against only 100/characters multibyte.

    However, there are a few minor side effects. Few of them and a comparison of the performance is described here: http://arjudba.blogspot.de/2009/08/does-oversize-of-datatype-varchar2.html

    (1) the varchar2 column indexing 4000 could be a problem (the ora-01450 exceeded max key length).

    (2) the size of the table could be actually smaller for tables with many sparesly populated varchar2 4000 columns. I can't find the source for that at the moment, but it had to do with the way oracle reserves future space required for the column.

    (3) migration of rank is more likely to happen if the great texts are added (= update) later.

    (4) If you define a variable with % rowtype in the table, it will use more expensive space PGA

    (5) some tools like TOAD could get questions or need of more resources to operate on 4 k columns.

  • How to convert a timestamp varchar2 column (3)

    Hi all

    I have a column of field date with varchar2 data type:

    Date
    ----------
    13/03/2011 10:22
    13/03/2011 10:22


    I tried this:
    select to_timestamp(date,'HH24MI') from dual;
    IAM getting this error:

    ORA-01858: a non-digit character was found here where was waiting for a digital
    I want to convert date timestamp column (3) column

    846773 wrote:

    I want to convert date timestamp column (3) column

    TIMESTAMP is not time column. Look at him as a date with a better accuracy - it supports the franctional part of a second. In any case, use:

    Select to_timestamp (date, "DD/MM/YYYY HH: mi AM'") twice;

    SY.

  • VARCHAR2 columns stored as anything other than letters

    Hey guys out there.
    I use Oracle Forms, but I need to know all the columns in a table (columns VARCHAR2) that have data that was not saved as uppercase. That is why I posted my question here and not in the forms. Any help would be great. The shape, that I'm looking tables and many albums and a lot of VARCHAR2 columns :-)

    I looked at the description of all_tab_columns but I doubt that could give me the information I'm looking for.

    Thank you

    Published by: Roxyrollers on January 15, 2013 15:07

    There is no data dictionary attribute that indicates if the column given tiny inside. So the only option would be to check each column.

    Of course, you could write a bit of dynamic SQL to do this

    DECLARE
      l_sql_stmt varchar2(32000);
      l_cnt pls_integer;
    BEGIN
      FOR x IN (SELECT * FROM all_tab_columns WHERE data_type = 'VARCHAR2')
      LOOP
        l_sql_stmt := 'SELECT COUNT(*) FROM ' || x.owner || '.' || x.table_name || ' WHERE ' || x.column_name || ' != upper(' || x.column_name || ')';
        EXECUTE IMMEDIATE l_sql_stmt INTO l_cnt;
        IF( l_cnt > 0 )
        THEN
          <>
        END IF;
      END LOOP;
    END;
    

    This is going to be rather ineffective, however, particularly if the tables are large.

    Justin

  • Can we do Union between 2 fields in OBIEE formula column?

    Hello gurus,

    Can we do the union between 2 fields and calculate a column that in the criteria of the obiee report?

    Vieira says:
    Hey David,

    I m using the same method to evaulte year and MOnthname

    Year: YEAR (CURRENT_DATE)

    Name of the month: MONTHNAME (TIMESTAMPADD (SQL_TSI_MONTH-1, CURRENT_DATE))

    but I want both values in unique colmun...
    Because I have to create a report that runs to the year and last month both at the same time.
    so once I have it calculate such doin union between YEAR and MONTHNAME column, I'll use the PivotTable to create this report...
    So basically I want a column that has the CURRENT YEAR, LAST MONTHNAME as list of values. and that's the reason why I want the union in the formula in the column...

    Let me know if you need more information...

    OK, got it.

    So follow these steps:

    (1) in your first report, put your attribute columns and measure your column a dummy column.

    (2) place a filter on the column "equal to / in".

    MONTH = MONTH (table.date) (TIMESTAMPADD (SQL_TSI_MONTH-1, CURRENT_DATE))

    (3) in the fx of the dummy column, delete content and enter 'Previous month' and name the 'Date Range' column (or whatever you want).

    This will generate a report where the measure is for the previous month.

    (4) in your second report, put the same attribute columns and measure your column a dummy column.

    (5) place a filter on the column "equal to / in".

    Year (table.date) = YEAR (CURRENT_DATE)

    (6) in the fx of the dummy column, delete the content and enter "current Year-to-Date" and name the 'Date Range' column (or what you want).

    This will generate a report where the measure is for the current year.

    (7) combine queries into a UNION.

    The synthesis report will have the values "previous month" and "current year-to-date" in the same column you want.

    (8) in your PivotTable, put the attribute columns in the Section of lines, as in measures Section and the 'Date Range' column in the columns Section.

    That should do it.

  • OBIEE 11 g: variable presentation use in the column header

    Hello world

    I was playing around with app sample dashboards and I saw a prompt of dashboard that they turned into a column selector. I liked and it reproduced in my own sandbox.

    I love the results, however, I would also like to change the column heading to indicate clearly how much has been selected. It's pretty clear when you're looking in the dashboard, but once you export the data, it can be confusing to what extent has been selected.

    This is why I would like to use a variable of presentation in the column header section. I tried to do, but he he interpreted as a literal instead of evaluation of the declaration.

    Is there anyway to get a variable in the column header?

    Thank you!

    -Joe

    Hello

    Take a look at the following links:

    http://oraclebizint.WordPress.com/2008/01/25/Oracle-BI-EE-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/

    display the variable of presentation on the table column header

    Set the presentation variable in the column header

    It will be useful.

    Kind regards
    Kalyan Chukkapalli
    http://123obi.com

  • the list of columns separated by commas of a dictionary table table

    I use the following question.

    CONNECT_BY_ROOT SELECT table_name TopLevel, level,
    connect_by_isleaf IS_Node_leaf,
    substr (SYS_CONNECT_BY_PATH (column_name, ','), 2) column_name
    Of all_tab_cols
    where connect_by_isleaf = 1
    and column_id < (select max (column_id) + 1 all_tab_cols
    where table_name = 'Table_test')
    and column_id > (select min (column_id) - all_tab_cols 1
    where table_name = 'Table_test')
    START WITH table_name = "Table_test."
    CONNECT BY PRIOR column_id = nocycle (column_id - 1).
    AND table_name = "Table_test."

    The only problem with this query is that it goes into infinite loop. Can someone suggest a better solution?

    Why you ask all_tab_cols, I think will realize you that it will pull all tables in your database.

    If you want to retrieve the name of the table and the columns (separated by commas) your schema, you must query user_tab_cols.

    and here is the sql code

    select table_name,ltrim(sys_Connect_by_path(column_name,','),',') column_names
    from
    (select table_name,column_name,row_number() over (partition by table_name order by column_id) rn
    from user_tab_cols)
    where connect_by_isleaf = 1
    start with rn=1
    connect by prior rn=rn-1 and prior table_name = table_name
    /
    

    Or, you can use all_tab_cols to query a specific table by passing the name of the table and the name of the owner

    PRAZY@11gR1> desc test
     Name
     -------------------------------------------
     NUM
     NUM2
    
    PRAZY@11gR1>
    select table_name,ltrim(sys_Connect_by_path(column_name,','),',') column_names
    from
    (select table_name,column_name,row_number() over (partition by table_name order by column_id) rn
    from all_tab_cols
    where owner='PRAZY' and
    table_name = 'TEST')
    where connect_by_isleaf = 1
    start with rn=1
    connect by prior rn=rn-1 and prior table_name = table_name
    /
    PRAZY@11gR1> /
    
    TABLE_NAME                     COLUMN_NAMES
    ------------------------------ ----------------------------------------
    TEST                           NUM,NUM2
    
    Elapsed: 00:00:00.01
    

    HTH,
    Prazy

    Published by: Prazy on April 28, 2010 10:23

  • Get only the Varchar2 column channels

    Hello
    How can I extract only strings form varchar2 column type?
    I have data like below.

    25 - Abc xy
    233 - xyz jj
    x23A
    9 - dd
    5 - AAA (pp)

    I need the outputs (-also be deleted)

    ABC xy
    XYZ jj
    xA
    DD
    AAA (pp)


    Thank you
    Sujnan

    Maybe...

    API> WITH t AS (SELECT '25-Abc xy' AS col FROM DUAL
      2          UNION
      3          SELECT '233-xyz jj' FROM DUAL
      4          UNION
      5          SELECT 'x23A'  FROM DUAL
      6          UNION
      7          SELECT '9-dd'  FROM DUAL
      8          UNION
      9          SELECT '5-aaa(pp)'  FROM DUAL)
     10    SELECT TRANSLATE(col, '1234567890-', ' ') AS RES
     11    FROM t;
    
    RES
    ----------
    xyz jj
    Abc xy
    aaa(pp)
    dd
    xA
    
    Transcurrido: 00:00:00.93
    
  • Only download the form type VARCHAR2 column numbers

    Hello
    How can I extract only numbers form varchar2 column type?
    I have data like below.

    25 - Abc
    233 - xyz
    x23A
    9 - dd

    I need following output
    25
    233
    23
    9

    Thank you
    Sujnan

    Hi try this

    SQL> with t as(select '25-Abc' test_string from dual union all
      2  select '233-xyz' from dual union all
      3  select 'x23A' from dual union all
      4  select '9-dd' from dual)
      5  select regexp_substr(test_string,'[[:digit:]]+') from t;
    
    REGEXP_
    -------
    25
    233
    23
    9
    
  • I HAVE A VARCHAR2 COLUMN.

    Hello


    I HAVE A VARCHAR2 COLUMN. IN THIS ARTICLE I STROED ALL CHARACTER DATA. A FILE EXCTION NAME,
    TEST. DOC, TEST2. DOC, TEST3. DOC AND TEXT_MAIN. DOC NOW, I WANT TO EXTRACT THE STRING UP. A CHARACTER THAT WORKS, I WANT TO USE TO GET THE MAXIMUM VALUE OF. CHERECTER, MEANS I DON'T WANT EXTENSION I WANT ONLY THE FILE NAME.

    Thank you

    One of the possibilities:

    SQL > SELECT SUBSTR('TEST.DOC',1,INSTR('TEST.DOC','.',1)-1) FROM DUAL;
    
    SUBS
    ----
    TEST
    
  • Changing a varchar2 column (11) to varchar2 (15)

    Hello

    I have a table of 600GO containing nearly 200 columns. This picture is obviously not truncated, it is a table partitioned and sous-partitionnée. I have a varchar2 column I need to increase the length. This table is in a production database and so I don't have TO run any risk with him even if I have to find a way to increase the size of the relevant column. Let's say that the table name is XLARGE_TABLE and the column I need to edit is called FIRST_COLUMN. I would like to know the safety and execution of the execution of the following simple ALTER statement:

    ALTER TABLE XLARGE_TABLE CHANGE FIRST_COLUMN varchar2 (15).

    NOTE: FIRST_COLUMN is filled throughout with millions of rows table.

    Thank you very much for your attention to help me in this regard.
    T. San.

    Hello

    Alter A VARCHAR2 (10) to VARCHAR2 (10) WILL take very very little time (micro seconds), it will stop any transaction instruction dml on tables.
    ---------------------------------------------------------------------------------------------------------
    SQL > desc emp;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------

    NAME VARCHAR2 (10)

    SQL > alter table emp change (name varchar2 (15));

    Modified table.

    SQL > desc emp;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------

    NAME VARCHAR2 (15)

    Published by: Rajesh.Rathod on January 25, 2009 13:27

  • Select the value of the field in the database column stores xml as a varchar

    Hi all

    Oracle version is 11 GR 2.

    I have a column of a database in which we store the XML string varchar2.

    "I need to extract only newvalue when field nameof the property ="modifiedBy'. '.

    In this case my answer would be - maker16

    My XML is as below.

    with t as
    (
    select '<?xml version="1.0" encoding="UTF-8"?>
    <changeinfo><property name="checkedOn" newvalue="03/21/2013 15:51:11" oldvalue="03/21/2013"/><property name="modifiedOn" newvalue="07/22/2013 14:04:55" oldvalue="03/21/2013"/><property name="phoneNo" newvalue="9942251"/><property name="modifiedBy" newvalue="maker16" oldvalue="clarissamaker"/></changeinfo>' as datacolumn
    FROM dual
    )
    select extractvalue(datacolumn,'/changeinfo/property name[@property name="modifiedBy"]/newvalue') from t;
    
    

    How to write a select statement to get the above result?

    Thank you

    SID

    You can do it like

    1. get the name and NewValue as columns and then create a filter with the WHERE clause.

    2. or you can filter when you set the path itself.

    --I have not applied the WHERE clause to filter the NAME. You can do that.
    
    SQL> with t as
      2  (
      3  select '
      4  
      5  
      6  
      7  
      8  
      9  ' as datacolumn
     10  FROM dual
     11  )
     12  select t1.name, t1.newval
     13    from t
     14       , xmltable
     15         (
     16            '/changeinfo/property' passing xmltype(datacolumn)
     17            columns
     18              name varchar2(100) path '@name',
     19              newval varchar2(100) path '@newvalue'
     20         ) t1;
    
    NAME                           NEWVAL
    ------------------------------ ------------------------------
    checkedOn                      03/21/2013 15:51:11
    modifiedOn                     07/22/2013 14:04:55
    phoneNo                        9942251
    modifiedBy                     maker16
    
    --This filters the Name attribute in the path definition itself.
    
    SQL> with t as
      2  (
      3  select '
      4  
      5  
      6  
      7  
      8  
      9  ' as datacolumn
     10  FROM dual
     11  )
     12  select t1.newval
     13    from t
     14       , xmltable
     15         (
     16            '/changeinfo/property[@name="modifiedBy"]' passing xmltype(datacolumn)
     17            columns
     18              newval varchar2(100) path '@newvalue'
     19         ) t1;
    
    NEWVAL
    ------------------------------
    maker16
    

    And the $ 1 million question would be why VARCHAR2 type of XML data.

  • The analysis of the VARCHAR2 column data to extract information

    Hi guys,.

    Let me give the information of DB first:

    SQL > select * from v version $;

    BANNER

    --------------------------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for Solaris: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

    My problem is: the interface of the application sends a large chain in VARCHAR2 (4000 BYTES) field. The string it sends is a bit like this-


    <strong>Crit:</strong> Some text. <br><strong>Distinguished</strong> (points 3):Some comment text1. <blockquote> </blockquote><strong>Crit:</strong> Some other text.<br><strong>Distinguished</strong> (points 3):Some comment text2. <blockquote> </blockquote><strong>Crit:</strong> Some more text. <br><strong>Distinguished</strong> (points 3):Some comment text3. <blockquote> </blockquote><strong>Overall comments:</strong><br> Final text!!
    I want to analyze the text and put in separate columns. Number of writes: maybe more than 3; its 3 up there. But the basic structure is the same. What is the best way to analyze this in PL/SQL code? I want something like

    Table 1
    Crit                       Points           Comment
    Some text                3        Some comment text1.
    Some other text        3        Some comment text2.
    Some more text        3        Some comment text3.
    Table 2
    Overall comments
    Final text!!
    Let me know if you need more information.


    Thank you.

    It could be a few slightly neater ways to do it with the REGULAR expression functions, but this will do what ypu want to:

    TABLE 1:

    WITH t AS
    (SELECT 'Crit: Some text. 
    Distinguished (points 3):Some comment text1.
    Crit: Some other text.
    Distinguished (points 3):Some comment text2.
    Crit: Some more text.
    Distinguished (points 3):Some comment text3.
    Overall comments:
    Final text!!' string FROM dual) SELECT SUBSTR(REGEXP_SUBSTR(string,'Crit:[^<]+', 1, level), 15) "Crit", SUBSTR(REGEXP_SUBSTR(string,'points [^\)]+', 1, level), 8) "Points", SUBSTR(REGEXP_SUBSTR(string,'\):[^<]+', 1, level), 3) "Comments" FROM t CONNECT BY LEVEL <= (LENGTH(string) - LENGTH(REPLACE(string, 'Crit:')))/5

    TABLE2:

    WITH t AS
    (SELECT 'Crit: Some text. 
    Distinguished (points 3):Some comment text1.
    Crit: Some other text.
    Distinguished (points 3):Some comment text2.
    Crit: Some more text.
    Distinguished (points 3):Some comment text3.
    Overall comments:
    Final text!!' string FROM dual) SELECT SUBSTR(string, INSTR(string, '', -1) + 8, INSTR(string, '', -1) - INSTR(string, '', -1) - 8) "Overall", SUBSTR(string, INSTR(string, '
    ', -1) + 4) "Final" FROM t
  • XMLP: How to display row XML field in the same column

    Hello

    I show a particulare column in my group of LINE in a single cell of table RTF?

    Example of XML data:

    < L_LINE_GROUP >

    < G_LINES >

    < LINE_ID > 1 < / LINE_ID >

    < ELEMENT > POINT A1 < / ITEM >

    < / G_LINE >

    < G_LINES >

    < LINE_ID > 2 < / LINE_ID >

    A2 POINT < ITEM > < / ITEM >

    < / G_LINE >

    ...

    < / L_LINE_GROUP >

    I show the ITEM as a concatenated in a table field.

    as. QUESTION A1 POINT A2 A3...

    I tried..? for each: G_LINES? > <? G_LINES? > <? end foreach? > inside the cell, it prints inside the cell, but each element of the new line. I need to display as a concatenated string.

    Thanks for supporting me how in rtf.

    Thank you and best regards,

    Raja.

    The code of the cell can be

    This will ensure that the values are concatenated

  • Organize PDF fields to populate the columns in the order in Excel

    I created a PDF form to transfer customer data received by the *.xml format, but the headers of the columns (field names) and data (field entries) fill on the same line in Excel.  Is there a way to define a the names of the fields to fill in a specific order in the first line and field entries to fill in the second row?  If not, is there a simple function to rearrange the data in Excel?

    Any help would be greatly appreciated.

    If you export data to a text file, it will be a file delimited by tabs that you can open in Excel with the field names in the first row and their values in the second.

    If you want to customize the order of the fields, you must use a script, however.

Maybe you are looking for

  • Boxes of the email lists? Add a note to an email?

    I'm in the middle of a long drop exercise on several years of mail. Most of the time I can use only one hand and cannot sit for a long time, in order to select the messages is more a problem that Thunderbird is designed to deal with. Most of my other

  • Satellite Pro L10 and Bt travel 2100

    Just bought new laptop L10 and have a BT Voyager home router. The laptop connects with Netgear and other connectors, but under no circumstances will connect with my BT Voyager 2100 to the House. Nobody knows the answer to this problem, and are they c

  • Error code: 656 (cannot install Silverlight)

    Can not update microsoft silverlight. I get the error code 656.  Help, please!

  • No display on TV when connected to the computer

    Original title: Laptop windows 7 to a standard tv There is no picture when I connect my laptop to my standard tv. The manufacturer of the cable said she would connect both the hdmi port to connect rca on my TV.

  • Install Windows own 10 - an extreme measure to clear the bad guys?

    Thus arose the issue of fear... "Dad, can fix you my laptop? After a good look, it has been well blessed with all sorts of undesirables. The viruses were easy (!).  But the Trojans are fighting back.  (AVG, dbghelp.dll and so on). As a Windows 7 mach