Hello !
I have the following query that I need to run on an automatic basis to produce a CSV file.
select case b.entityno1
when '001' then
'PLIC'
when '003' then
'PLAC'
when '005' then
'OLIC'
when '090' then
'ILIC'
when '091' then
'NILIC'
when '057' then
'NILICS'
when '060' then
'ILICS'
else
'PLIC'
end as ORGUNIT,
case b.entityno1
when '001' then
'UYB'
when '003' then
'UYB'
when '005' then
'USB'
when '090' then
'USB'
when '091' then
'ABB'
when '057' then
'BGY'
when '060' then
'BGY'
else
'FTB'
end as BANK,
when '001' then
'PLIC'
when '003' then
'PLAC'
when '005' then
'OLIC'
when '090' then
'ILIC'
when '091' then
'NILIC'
when '057' then
'NILICS'
when '060' then
'ILICS'
else
'PLIC'
end as COMPANY,
concat(substr(b.entityno1, -2, 2), substr(b.invname, 1, 7)) as DEST,
to_char(to_date(a.duedate, 'yyyymmdd'), 'dd-MON-yyyy'),
to_char(to_date(a.duedate, 'yyyymmdd'), 'dd-MON-yyyy'),
lpad(trunc(a.cashflow, 2),18,'0'),
case b.entityno1
when '001' then
'68768478354'
when '003' then
'46746764765'
when '005' then
'34545435444'
when '090' then
'23423432423'
when '091' then
'07023353159'
when '057' then
'34534534534'
when '060' then
'89664346354'
else
'56757537457'
end as ACCOUNT
from cashflow a, investor b
where a.invid = b.invid;
The CSV file should have a fixed header similar to:
#Orgunit,Bank,Category, Company,Dest, Release, DateFld, Amount,Account, Source
Also, the value of Source and Category in the CSV file should be hard-coded to 'M IN' and 'MLA' respectively.
Any help will be greatly appreciated !
I have the following query that I need to run on an automatic basis to produce a CSV file.
select case b.entityno1
when '001' then
'PLIC'
when '003' then
'PLAC'
when '005' then
'OLIC'
when '090' then
'ILIC'
when '091' then
'NILIC'
when '057' then
'NILICS'
when '060' then
'ILICS'
else
'PLIC'
end as ORGUNIT,
case b.entityno1
when '001' then
'UYB'
when '003' then
'UYB'
when '005' then
'USB'
when '090' then
'USB'
when '091' then
'ABB'
when '057' then
'BGY'
when '060' then
'BGY'
else
'FTB'
end as BANK,
when '001' then
'PLIC'
when '003' then
'PLAC'
when '005' then
'OLIC'
when '090' then
'ILIC'
when '091' then
'NILIC'
when '057' then
'NILICS'
when '060' then
'ILICS'
else
'PLIC'
end as COMPANY,
concat(substr(b.entityno1, -2, 2), substr(b.invname, 1, 7)) as DEST,
to_char(to_date(a.duedate, 'yyyymmdd'), 'dd-MON-yyyy'),
to_char(to_date(a.duedate, 'yyyymmdd'), 'dd-MON-yyyy'),
lpad(trunc(a.cashflow, 2),18,'0'),
case b.entityno1
when '001' then
'68768478354'
when '003' then
'46746764765'
when '005' then
'34545435444'
when '090' then
'23423432423'
when '091' then
'07023353159'
when '057' then
'34534534534'
when '060' then
'89664346354'
else
'56757537457'
end as ACCOUNT
from cashflow a, investor b
where a.invid = b.invid;
The CSV file should have a fixed header similar to:
#Orgunit,Bank,Category, Company,Dest, Release, DateFld, Amount,Account, Source
Also, the value of Source and Category in the CSV file should be hard-coded to 'M IN' and 'MLA' respectively.
Any help will be greatly appreciated !