Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cdeafa

Browse files
committed
Use same function to parse path params
1 parent 6e7658d commit 7cdeafa

1 file changed

Lines changed: 7 additions & 24 deletions

File tree

client_source/sqlplus/ut_run.sql

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -253,36 +253,19 @@ declare
253253
return 'false';
254254
end;
255255

256-
function parse_source_path_param(a_params ut_varchar2_list) return varchar2 is
256+
function parse_path_param(a_params ut_varchar2_list, a_param_name varchar2) return varchar2 is
257257
l_path varchar2(4000);
258258
begin
259259
begin
260-
select source_path
260+
select param_value
261261
into l_path
262-
from (select regexp_substr(column_value,'-source_path\=(.*)',1,1,'c',1) as source_path from table(a_params) )
263-
where source_path is not null;
262+
from (select regexp_substr(column_value,'-'||a_param_name||'\=(.*)',1,1,'c',1) as param_value from table(a_params) )
263+
where param_value is not null;
264264
exception
265265
when no_data_found then
266266
l_path := '-';
267267
when too_many_rows then
268-
raise_application_error(-20000, 'Parameter "-source_path=source_path" defined more than once. Only one "-source_path=source_path" parameter can be used.');
269-
end;
270-
return l_path;
271-
end;
272-
273-
function parse_test_path_param(a_params ut_varchar2_list) return varchar2 is
274-
l_path varchar2(4000);
275-
begin
276-
begin
277-
select test_path
278-
into l_path
279-
from (select regexp_substr(column_value,'-test_path\=(.*)',1,1,'c',1) as test_path from table(a_params) )
280-
where test_path is not null;
281-
exception
282-
when no_data_found then
283-
l_path := '-';
284-
when too_many_rows then
285-
raise_application_error(-20000, 'Parameter "-test_path=test_path" defined more than once. Only one "-test_path=test_path" parameter can be used.');
268+
raise_application_error(-20000, 'Parameter "-'||a_param_name||'='||a_param_name||'" defined more than once. Only one "-'||a_param_name||'='||a_param_name||'" parameter can be used.');
286269
end;
287270
return l_path;
288271
end;
@@ -310,8 +293,8 @@ begin
310293
:l_paths := parse_paths_param(l_input_params);
311294
:l_color_enabled := parse_color_enabled(l_input_params);
312295

313-
:l_source_path := parse_source_path_param(l_input_params);
314-
:l_test_path := parse_test_path_param(l_input_params);
296+
:l_source_path := parse_path_param(l_input_params,'source_path');
297+
:l_test_path := parse_path_param(l_input_params,'test_path');
315298

316299
if l_run_cursor_sql is not null then
317300
open :l_run_params_cur for l_run_cursor_sql;

0 commit comments

Comments
 (0)