<html><div style='background-color:'><DIV>
<DIV class=RTE>Hi all</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>I'm writing a MS DOS batch script to delete some expired rows from my PostgreSQL DB and also some associated file (which full path is stored in DB). In order to fulfil that, I have to get the date and path from DB, and delete the expired row as well as the file associated with that row. So now 2 have to approaches:</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>1. Write a plpgsql scrip and run it by psql. Inside the plpgsql script I have to delete the file in hard disk, but till now I could not find any way to do that. I do not know whether plpgsql can support some type of file manipulation? </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>2. Delete the file from MS DOS batch script ( it is easier), but I have to pass the query result (which is mostly an array) to the MS DOS batch script.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>For the second approach, my first try is to output the query result to a text file </DIV>
<DIV class=RTE>(eg: bash -c "psql -d DBname -c "select COLUMN_name from A_table WHERE...;" > result.txt")</DIV>
<DIV class=RTE>but the text file is such a complicated file with name of column and some symbol ----- so it is difficult to extract the result.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>So do you have any suggestion for my problem? Is there any way to delete file within the plpgsql block, or sending query result to MS DOS script in a convenient way for being processed.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Thank you very much. </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Regards</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Pham Luu Hung</DIV></DIV></div><br clear=all><hr>Add photos to your e-mail with <a href="http://g.msn.com/8HMBEN/2746??PS=">MSN 8.</a> Get 2 months FREE*.</html>