Custom Insert function

Started by Brian C. Doyleover 24 years ago2 messagesgeneral
Jump to latest
#1Brian C. Doyle
bcdoyle@mindspring.com

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

#2Jan Wieck
JanWieck@Yahoo.com
In reply to: Brian C. Doyle (#1)
Re: Custom Insert function

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