How to convert the string stored in a column in lines

Hi gurus,
BANNER
----------------------------------------------------------------
Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
I have following string

Sports / Sports cards / Basketball / Baseball

I want to convert as follows

Sport
Sports cards
Basketball
Baseball

Any help would be very appropriate.

Thanks in advance

On 10g:

with t as
(select 'Sports / Sports Cards / Basketball / Baseball' as col from dual)
 SELECT
        case pivot
          when 1 then
        regexp_substr(t.col, '[^/]+', 1, 1)
          when 2 then
        regexp_substr(t.col, '[^/]+', 1, 2)
          when 3 then
        regexp_substr(t.col, '[^/]+', 1, 3)
          when 4 then
        regexp_substr(t.col, '[^/]+', 1, 4)
        end case,
  pivot
  from t,  (SELECT rownum pivot from dual CONNECT BY LEVEL <=4)

Tags: Database

Similar Questions

  • How to convert the string with numbers in the table of Boolean 2D

    Hello

    I have input a string with comma separated numbers 1,192 (starting at 1).

    This string must be converted to a table 2D-boolean. Each number that appears should be true, not true rest.

    The 2D table consists of 4 times of 0.47 Boolean values.

    1.48--> [0.47] numbers [0]
    49.96--> [0.47] numbers [1]
    Numbers 97.144--> [0.47] [2]
    145.192--> [0.47] numbers [3]

    If a '1, 49, 97 145' input string put all [0] [0.3] true.

    How can it be easy/fast resolved?

    Thanks for help

    Break the string of numbers in a table of numbers.  (Spreasheet String to Array).

    In a loop For, index with each issue of this table.  Use in the range and Coerce to see if it is in the range of numbers.  (You can put this in a loop For as auto good indexing through the ranges).  If it's in the range, then use subset replace table to activate the corresponding item in a real.  If this is not the case, do nothing.  Maintain the table of Boolean in a shift register.

    Repeat this step for each number in your table.

    (What is a class assignment?)

  • How to convert the string with numbers in U8 with ascii

    Hello

    I have a string with only numbers 0. 9 paper.

    Now, I want to convert to table-U8.

    He works here, but now the problem: How can I change each character to its ascii value?

    Example:

    entry: 123 (string)

    output: x 31, x 32, x 33 (U8-array)

    Thanks for the help

    It's very easy

    String to Byte Array Function
    Have the Palette: string/array/path Conversion functions

    Converts a string to an array of unsigned bytes. Each byte in the array has the ASCII value of the character corresponding to the string.

  • How to convert the string in milliseconds

    Hello

    Please suggest how I can convert a string (October 9, 1989) in milliseconds...

    If it has a certain format, you can use HttpDateParser, otherwise create a calendar object, set the relevant values and get the time to it.

  • How to convert the string to a full decimal point and left shift

    Hey guys I tried to convert gps string to an integer, like this

    A string that is 2467.8976 and I need to convert it to a similar integer as point of this 2467.8979 so that I can shift the decimal point to the left (24.678979) which i coudnt do it with the chain. It's just been my 2 weeks with the labview so be gentle. Thank you

    Hi Awais07,

    Once you have created an indicator that signals the output of parsing the string, right-click on this indicator > display... Format > increase the value of the digit 9

    Kind regards

    Lennard.C

  • How to convert the string to the variable of the apex

    Hello

    I need to replace the overall point of the table column value chain in its value of origin when the page is rendered.

    the process code - plsql
    -column replacestring contain the string F100_EMPID value
    declare
    REP varchar2 (100);
    Start
    Select replacestring in the rep of emp;
    Select Replace ('EmployeeID', replacestring) in the content of emp;
    HTP.p (content);
    end;

    The output is:
    The employee ID is: F100_EMPID.

    but I need the actual value of the global element when the process is rendered.

    Select Replace (content, "EmployeeID",: F100_EMPID) in the content of emp;

    This statement gives a correct output: Employee id is: 230092

    I need to replace the string in the column of the table in the real global element inside the plsqcode for dynamic rendering code.

    someone please help me solve this problem.

    Thank you.
    ~ Logaa

    Hello

    What happens if you use:

    Select Replace (happy, 'EmployeeID', v (replacestring)) in the content of emp;
    or maybe
    Select Replace (content, "EmployeeID", v ("| replaceString |")) in the content of emp;

    Greetings,
    Roel

    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.Logica.com/

    You can assign this answer to your question in marking it as useful or Correct ;-)

  • How to convert the string 'True' to Boolean

    Hi all

    I have strings as 'True' and 'False. ' I want to convert to a Boolean value so that I can change the value of the check box control.

    Thank you best regards &,.

    Shrinivas

    Ford Hi,

    Just compare with a string constant 'TRUE' for equality (maybe do a uppercase or lowercase conversion front to channel more easy to handle...)!

  • How to convert the string Primitive in PMString.

    Hello

    I'm working on string manipulation tasks. I have a primitive type string (std::string), I want to turn it into PMString. Does anyone know how to do this?

    Cann't we use directly instead of WideString PMString?

    Like: -.

    std::string tempString ("TempString");

    PMString tempPMString (tempString.c_str ());

    tempPMString.Append (tempWideString);

    ????

  • Convert the string with number of floats a number

    How to convert the string as "- 8.9E - 03" to a number of TestStand?

    Thanks in advance

    Hello

    Try to use the Val() function

    In the expression, it looks like this

    People of the country

    .nValue = val (Locals.strValue)

    Locals.nValue = Val("-8.9E-03")

    Hope this helps

    Jürgen

  • How to convert a string and use a rope as a property?

    I have an array in the following format:

    {ownsCar: 'true', ownsBike: 'true', ownsHouse: 'true'}

    {ownsCar: ownsBike 'false',: 'true', ownsHouse: 'true'}

    {ownsCar: 'true', ownsBike: ownsHouse 'false',: 'true'}

    etc ............

    And I need to test against each element, for example

    If...

    myDataGrid ["myItem"] .ownsCar is object (myCheckbox) .label

    ... then

    If...

    myDataGrid ["myItem"] .ownsBike is object (myCheckbox) .label

    ... then

    If...

    myDataGrid ["myItem"] .ownsHouse is object (myCheckbox) .label

    ... then

    But I have to build my application where the property (for example 'ownsCar', 'ownsBike', 'ownsHouse') is a variable such as:

    If...

    myDataGrid ["myItem"] .myProperty is object (myCheckbox) .label

    ... then

    I would like to browse my table, by counting the number of items and then use each element as a property.

    How to convert the string (for example, "ownsCar") in a property "myProperty"?

    Thanks in advance

    Chris

    OK, if I got this right what you need to do is introspection.

    The easiest way to do this would be:

    for ( var propertyName:String in myObject ) {
         // Do what you need with this here:
         myObject[ propertyName ];
    }
    
  • How do to convert the string (with the Hex data) in number?

    Hello

    I use TestStand 3.5 to automate a few test cases associated with boot loader.

    The requirement is that I need to read the value in some places for specific address. The values of these addresses are stored in a hexadecimal format.

    We have a step customized in TestStand through which we can read these values by address, but she returns as the type "String".

    For example, the value to 0 x 0000008 is 000001 B 2, and he returned in Locals.Value_Read as "000001 B 2" in the string.

    Is it possible, I can convert the string "000001 B 2" to a number?

    I tried to use the function-> val (locals. Value_Read), but it is return 0 as TestStand figures that the input string is not representing the valid number.

    Please help me with this.

    Thank you and best regards,

    Niraj.

    Try: Val ("0 x" + Locals.Value_Read)

  • How to convert the following code in as3?

    As the title says... How to convert the following code to as3?... Thanks in advance.

    import flash.display.BitmapData;

    linkageId = "landscape";
    myBitmapData = BitmapData.loadBitmap (linkageId);


    MC = this.createEmptyMovieClip ("mc", 1);
    mc.attachBitmap (myBitmapData, 1);

    onMouseMove = function() {}
    myNewColor = "0 x" + myBitmapData.getPixel(_xmouse,_ymouse).toString (16);
    newColor.setRGB (myNewColor);
    selectedColor.colorValue.text = myNewColor;
    }
    selectedColor.swapDepths (_root.getNextHighestDepth ());
    newColor = new Color (selectedColor.sample);

    :

    var myBitmapData:landscape = new landscape (0,0);

    var bmp:Bitmap = new Bitmap (myBitmapData);
    addChild (bmp);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, f);

    function f(e:MouseEvent):void {}
    var myNewColor:String = "0 x" + myBitmapData.getPixel(mouseX,mouseY).toString (16);
    newColorTransform.color = uint (myNewColor);
    selectedColor.sample.transform.colorTransform = newColorTransform;
    selectedColor.colorValue.text = myNewColor;
    }
    addChild (selectedColor);
    var newColorTransform:ColorTransform = selectedColor.sample.transform.colorTransform;

  • [Oracle 8i] How to convert a string (timestamp) in a date?

    I find it difficult to know how to convert a string to a date time stamp (or possibly several).

    The timestamp is 20 positions, character (NOT NULL, CHAR (20))
    in the format: YYYYMMDDHHMMSSUUUUUU
    where Y = year, M = month, D = day, M = Minutes, S = seconds and U = microseconds

    The reason why I want to convert it is so that I can compare a timestamp to each other (that is, I want to be able to find the MIN (timestamp), MAX (timestamp) and make comparisons of inequality).

    Is this possible?

    Thanks in advance for the help on this!

    Hello

    As Damorgan said, if all you want to do is find which is the earlier or later, then you can just compare the strings: they are in a format where it works.

    If you need to do other things, such as compare to today date or see the difference between two of your lines of days, you will need to convert it to date. (He has no reason to convert them to numbers).

    A new TIMESTAMP data type, which manages the fractions of a second, was introduced in Oracle 9.
    Since you use Oracle 8 (depending on your subject line), or it must be
    (1) ignores the microseconds, or
    (2) use a separate column for microseconds.

    Whatever it is, use TO_DATE to convert the first 14 characters in DATE:

    TO_DATE ( SUBSTR (txt, 1, 14)
            , 'YYYYMMDDHH24MISS'
            )
    

    where txt is your column of type CHAR.
    To convert microseconds to a number (between 0 and 999999):

    TO_NUMBER (SUBSTR (txt, 15))
    
  • How to convert the precision extended float to float in C++

    Hello

    Could someone me please how to convert the extended precision (floatExt) float normal float in C++?

    What is the difference in the float between Labview and C++ data type?

    When I tried to receive a range of float of a function of the DLL generated by Labview in C++, data are bad.

    Thank you

    Victor King

    You can search for numeric data types in LabVIEW help for more information on the different types of data. Before sending the data to the C++ application, you can use the function of Double precision on digital / range of Conversion to convert number to Double precision.

  • How to get the string (specified by row and column) of txt file with labview

    Hello world

    How to get the string (specified by row and column) of txt file with labview

    THX

    As far as I know, a text file has no column.  Be more specific.  Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character?  You can read from the spreadsheet String function and set the delimiter to a space.  This will produce a 2D channels table.  Then use the table to index and give the line number and column number.

Maybe you are looking for