--Script to create a data file with custom header--
	--To run file execute at command prompt sqlplus @
	username/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.10)(PORT=1800))(CONNECT_DATA=(SERVICE_NAME=WhTVR)))
	SET PAGESIZE 0
	SET LINESIZE 20
	SET term off
	SET feed off
	SET underline off
	SPOOL C:\Users\userid\GIT\project\sql\JobID.dat
	PROMPT JobID
	select something from sometable; 
	SPOOL OFF
	quit
	
	

--Script to get data for some period of time --
	 select sbj_no from sjb where sbj_no in(
        select sbj_no from prj.sbj_activity where CREATED_DATETIME > sysdate - interval '1' day and ASSIGN = 'N' 
    ) 
    and INIT_SERVICE_CODE IN ('name1', 'name2', 'name3')
    and sbj_no not in(select sbj_NO from prj.sbj_activity where ACTIVITY_CODE = 'actcode')
    order by created_datetime desc fetch first 100 row only

select count(isr_no) from C07_isr_activity where CXX_XXXXXX = 'XX' and CXX_START_DATETIME >= to_date('01 MAY 2021', 'DD MON YYYY')


	Another example

GoBack