Below is my requirement:
- I want to generate a text file named as DBService_DateTimeStamp_UpgradeScipts.txt where
- DBService=> is the oracle service name against which the script is executed(dit/fit etc.)
- DateTimeStamp=>Current date time stamp upto seconds and
- UpgradeScipts->static text
Below is my script part:
SET SERVEROUTPUT ON
DECLARE fileName VARCHAR2(100);
--Declare tStamp VARCHAR2(100);
BEGIN
DECLARE fileName VARCHAR2(100);
Declare tStamp VARCHAR2(100);
select sys_context('userenv','service_name') into fileName from dual;
--SELECT SYSTIMESTAMP into tStamp FROM DUAL;
--fileName:= fileName || '_' || tStamp;
--Dbms_Output.Put_Line('' || TIMESTAMP(3));
--spool UpgradeClients.txt --here the desired file name should be like
-- svc1_03-APR-17-12.51.12 AM.txt
END;
/
I think I am close to it, any help will be highly appretiated.