Thread: Custom Insert function

Custom Insert function

From
"Brian C. Doyle"
Date:
Hello all,

Is it possible to create a function that would look like
this_function('file.csv');

and make it run
COPY this_table FROM '/this/location/file.csv' USING DELIMITERS ',';

Thus eliminating alot of repeated work each time???

if so what would I put on the returns


Re: Custom Insert function

From
Jan Wieck
Date:
Brian C. Doyle wrote:
> Hello all,
>
> Is it possible to create a function that would look like
> this_function('file.csv');
>
> and make it run
> COPY this_table FROM '/this/location/file.csv' USING DELIMITERS ',';
>
> Thus eliminating alot of repeated work each time???
>
> if so what would I put on the returns

    Looks like a job for PL/TclU. It could read an external file,
    do all the necessary conversions with Tcl's enhanced  regular
    expressions  and  execute  inserts  unsing  a prepared INSERT
    plan.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com