Results 1 to 2 of 2

Thread: need sql query

  1. #1
    Join Date
    Apr 2013
    Posts
    1

    Unanswered: need sql query

    Hi Team,

    I need query to split string into individual characters and each character will display in separate row.

    For Example, I have a word like mysweet the output should be
    m
    y
    s
    w
    e
    e
    t

    I am new to oracle.can you please provide the query for this.

    Thanks in Advance

    lakshmi

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Here you go:
    Code:
    SQL> with test as (select 'mysweet' col from dual)
      2  select substr(col, level, 1) letter
      3  from test
      4  connect by level <= length(col);
    
    L
    -
    m
    y
    s
    w
    e
    e
    t
    
    7 rows selected.
    
    SQL>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •