Cursor and CSV using utl_file package

147 Views Asked by At

Hi I want to create a csv file using plsql utl file. For that I am creating cursor in utl file but I dont want to enter duplicate data. Because I want to create that csv file daily from the same table. Please help

I tried by cursor but I have no idea how to restrict duplicate entries because I want to create the csv file from same table on daily basis

1

There are 1 best solutions below

0
Littlefoot On

A cursor selects data; it is its where clause that filters which data it'll return.

Therefore, set it so that it fetches only rows you're interested in. For example, one option is to use a timestamp column which tells when was that particular row inserted into the table. Cursor would then

select ...
from that_table
where timestamp_column >= trunc(sysdate)

to select data created today. It is up to you to set it to any other value you want.