logo       

copy from command - quotes and header lines: msg#00381

Subject: copy from command - quotes and header lines
a) First an observation about populating tables.
The standard syntax for literal values is to put single quotes around all the strings and not around the numbers eg
insert into table values ('London', 12, 15.7);
However when bulk loading from files it needs an extra step to find out which fields to put the quotes around.  By experimenting, I have found that the INSERT command will allow quotes around all the fields eg
insert into table values ('London', '12', '15.7');
but not the converse
insert into table values (London, 12, 15.7);
 
On the other hand the COPY FROM file command has it the other way round - if the separators are semi-colons then the source file
London;12;15.7
Paris;13;22.2
will work
 
but
'London'; '12'; '15.7'
'Paris';'13';'22.2'
will not!
 
Any comments?  If this behaviour works it is certainly convenient as well as surprising, provided one knows what to do!
 
b) My source files for populating the database tables have three header lines.  It would be convenient if the COPY FROM command had another parameter eg "HEADERS n" meaning skip first n lines of input file.  Assuming I have not missed something in the manual, would it be possible to request an enhancement along these lines?   The R statistical package allows one to skip n header lines so this must be a common situation.  My current workaround uses a perl pipe but I would prefer a cleaner solution.
 
Regards
Kenneth Evans
 
 
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe