0% found this document useful (0 votes)
112 views1 page

L - String: AAAA:BBBB:CCCC:DDDD' L - Var1: AAAA' L - Var2: 'BBBB' L - Var3: CCCC' L - Var4: 'DDDD'

The document declares a string variable l_string with a value of 'AAAA:BBBB:CCCC:DDDD' and four additional variable l_var1, l_var2, l_var3, l_var4. It then uses a regular expression and the REGEXP_SUBSTR function to split the string at the ':' delimiter and assign each substring to the corresponding l_var variable. Finally, it prints out the values of each l_var variable.

Uploaded by

rajeswar9
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views1 page

L - String: AAAA:BBBB:CCCC:DDDD' L - Var1: AAAA' L - Var2: 'BBBB' L - Var3: CCCC' L - Var4: 'DDDD'

The document declares a string variable l_string with a value of 'AAAA:BBBB:CCCC:DDDD' and four additional variable l_var1, l_var2, l_var3, l_var4. It then uses a regular expression and the REGEXP_SUBSTR function to split the string at the ':' delimiter and assign each substring to the corresponding l_var variable. Finally, it prints out the values of each l_var variable.

Uploaded by

rajeswar9
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

l_string : = AAAA:BBBB:CCCC:DDDD;

l_var1:= AAAA;

l_var2:= BBBB;

l_var3:= CCCC;

l_var4:= DDDD;

Script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

DECLARE
l_string VARCHAR2(100) := 'AAAA:BBBB:CCCC:DDDD';
l_var1
VARCHAR2(240);
l_var2
VARCHAR2(240);
l_var3
VARCHAR2(240);
l_var4
VARCHAR2(240);
BEGIN
SELECT trim('"'
FROM regexp_substr(l_string,'".*?"|[^:]+',1,1)) Col1,
trim('"'
FROM regexp_substr(l_string,'".*?"|[^:]+',1,2)) Col2,
trim('"'
FROM regexp_substr(l_string,'".*?"|[^:]+',1,3)) Col3,
trim('"'
FROM regexp_substr(l_string,'".*?"|[^:]+',1,4)) Col4
INTO l_var1 ,
l_var2 ,
l_var3 ,
l_var4
FROM dual ;
dbms_output.put_line('Var1 : ' ||l_var1);
dbms_output.put_line('Var2 : ' ||l_var2);
dbms_output.put_line('Var3 : ' ||l_var3);
dbms_output.put_line('Var4 : ' ||l_var4);
END;

You might also like