| |

VerySource

 Forgot password?
 Register
Search
View: 903|Reply: 6

[Copy link]

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

Post time: 2020-2-9 22:00:02
| Show all posts |Read mode
If there is a string "aa, bb, cc, dd", how to realize the separation according to "," and take out the strings "aa", "bb", "cc", "dd"
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-4-4 07:45:01
| Show all posts
substring ('aa, bb, cc, dd', 1,2)
substring ('aa, bb, cc, dd', 4,2)
substring ('aa, bb, cc, dd', 7,2)
substring ('aa, bb, cc, dd', 10,2)
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

 Author| Post time: 2020-4-4 16:00:01
| Show all posts
Not so, the number of characters in it is not necessarily 2
The string may be ('aa', 'dfsd', 'sdfaw', 'dsfdsfadsf')
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

 Author| Post time: 2020-4-4 20:15:01
| Show all posts
It ’s best to find out where each "," is
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-6 18:45:02
| Show all posts
where the instr function finds

Cyclic processing
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-7 14:45:01
| Show all posts
DECLARE
j INT;
aa VARCHAR2 (300);
bb VARCHAR2 (10);
cc VARCHAR2 (20);
BEGIN
j: = 1;
aa: = 'aa, bb, cc, dd';
bb: = ',';
WHILE j <> 0
LOOP
j: = INSTR (aa, bb);
IF j = 0 THEN
cc: = SUBSTR (aa, j + 1, LENGTH (aa));
ELSE
cc: = SUBSTR (aa, 1, j-1);
aa: = SUBSTR (aa, j + 1, LENGTH (aa));
END IF;
--DBMS_OUTPUT.PUT_LINE (aa);
--DBMS_OUTPUT.PUT_LINE (j);
DBMS_OUTPUT.PUT_LINE (cc);
END LOOP;
END;
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-7 15:30:02
| Show all posts
aa
bb
cc
dd
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list