Nie powiedziałeś nam, jakie faktycznie są warunki, więc musisz podać szczegóły.
CLIENT_TEXT_IO.put (TFile, 'Validation No.1 : ' );
if condition_1 then
CLIENT_TEXT_IO.put_line (TFile, 'OK');
else
CLIENT_TEXT_IO.put_line (TFile, 'ERROR');
end if;
CLIENT_TEXT_IO.new_line (TFile);
CLIENT_TEXT_IO.put (TFile, 'Validation No.2 : ' );
if condition_2 then
CLIENT_TEXT_IO.put_line (TFile, 'OK');
else
CLIENT_TEXT_IO.put_line (TFile, 'ERROR');
end if;
W takim przypadku możesz chcieć zapakować to w funkcję pomocniczą:
PROCEDURE VALIDATION_TEST (p_mid we_group_hof_k.mstatusid%TYPE,
p_status we_group_hof_k.cardstatus%TYPE ) is
LC$Line Varchar2(4000);
TFile CLIENT_TEXT_IO.FILE_TYPE ;
procedure print_validation (
p_file in CLIENT_TEXT_IO.FILE_TYPE
, p_validation_number in number
, p_condition in Boolean )
is
begin
CLIENT_TEXT_IO.new_line (p_file);
CLIENT_TEXT_IO.put (p_file, 'Validation No.'||to_char(p_validation_number) || ': ' );
if p_condition then
CLIENT_TEXT_IO.put_line (p_file, 'OK');
else
CLIENT_TEXT_IO.put_line (p_file, 'ERROR');
end if;
end print_validation;
begin
insert into test
select mstatusid, cardstatus
from we_group_hof_k
where mstatusid = p_mid
and cardstatus = p_status;
IF p_mid = 1 AND p_status = 'A' THEN
LC$Line := 'log_' || TO_CHAR (SYSDATE, 'yyyymmdd_HH24miss') || '.log';
TFile := CLIENT_TEXT_IO.FOpen( 'E:\HMIS\State\test.log', 'W' );
CLIENT_TEXT_IO.put_line (TFile, 'Log file ' || LC$Line);
print_validation(TFile, 1, condition_1);
print_validation(TFile, 2, condition_2);
...
print_validation(TFile, 15, condition_15);
CLIENT_TEXT_IO.fclose (TFile);
END IF;
end;