Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.
Moderator: General Moderators
construct
Forum Newbie
Posts: 5 Joined: Sat Jul 02, 2011 12:58 pm
Post
by construct » Sat Jul 02, 2011 1:29 pm
I added some code to import a csv file.
I'm sharing it here as well as my
csv import function :
Code: Select all
function importCSV {
$handle = fopen("file.csv", 'r');
while(($data = fgetcsv($handle, 1000, ",")) !== false)
{
list($col1, $col2, ...) = $data;
}
fclose($handle);
}
McInfo
DevNet Resident
Posts: 1532 Joined: Wed Apr 01, 2009 1:31 pm
Post
by McInfo » Sat Jul 02, 2011 4:58 pm
There are two syntax errors:
invalid function definition (no parameter list)
invalid list() syntax (pseudo-code?)
The function has no inputs, no output, and no useful side-effects; so what is the purpose?
Esteban11
Forum Newbie
Posts: 3 Joined: Thu Nov 10, 2011 4:46 am
Post
by Esteban11 » Mon Nov 21, 2011 5:42 am
I've been searching for a while now but can't seem to find answers so here goes...
I've got a CSV file that I want to import into a table in Oracle (9i/10i).
Later on I plan to use this table as a lookup for another use.
This is actually a workaround I'm working on since the fact that querying using the IN clause with more that 1000 values is not possible.
How is this done using SQLPLUS?