Hi all
I would like to create a function that copies CDR-records from text files. This should be done every hour, so I want my function to look something like this:
CREATE OR REPLACE FUNCTION cdr_copy( ) RETURNS VOID AS $$
DECLARE
mytime TIMESTAMP := timeofday( );
cdr_path CHAR(50) := '/home/cdr/';
cdr_file CHAR(50) := cdr_path + myime;
BEGIN
...
...
COPY mytable FROM $cdr_file DELIMITER AS ' ';
Since COPY don't take a variable, but only do relative path, then what to do?
Any suggestions?
Regards,
Henrik
I would like to create a function that copies CDR-records from text files. This should be done every hour, so I want my function to look something like this:
CREATE OR REPLACE FUNCTION cdr_copy( ) RETURNS VOID AS $$
DECLARE
mytime TIMESTAMP := timeofday( );
cdr_path CHAR(50) := '/home/cdr/';
cdr_file CHAR(50) := cdr_path + myime;
BEGIN
...
...
COPY mytable FROM $cdr_file DELIMITER AS ' ';
Since COPY don't take a variable, but only do relative path, then what to do?
Any suggestions?
Regards,
Henrik