Methods of SQL Traversal string

Source: Internet
Author: User

String traversal:

1. Create a table--temp that only has an increment sequence (1...N) andperform a Cartesian operation with the table SRC where the target string resides . ( the number of records in the Temp table is either less than the length of the traversed target string)

2. filter out rows with a sequence value greater than the string length.

3. Traverse using the substr () built-in function.

The table structure is as follows:

Temp SRC

ID ID Name Other

1 1 Paul KKK

2

3

4

5

6

7

8

The Traverse results View is:

A

P

A

U

L

1     Select substr (S.name,iter.pos,1) A,2from           (select  Fromwhere=  ' Paul ') s,3              (select from Temp ) ITER4     where<= Length (s.name)

Methods of SQL Traversal string

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.