Thank you for your response , no steve I don't have any experience there . Perhaps a perl script could also help because I'm looking to have reusable script .
I use Perl and Bash everyday. I have written a lot of scripts that I use over and over. Delimited files arent hard to work with with Perl. Look at the split routine for Perl to start with. File handlers. Reach out to me if you need help with it.
I have written an sql query , my intentions are to read and store the data to a tmp table, after that i want to read and insert into two tables that are related through a many to many relation ship . is this the right approach ? .
if it is how can i convert the following sql statements into perl scripting syntax
CREATE TEMPORARY TABLE tmp_import (`record_number` INT(10) NOT NULL PRIMARY KEY ,
id_number VARCHAR(50), `first name` VARCHAR(255) , `last name` VARCHAR(255) ,
msisdn VARCHAR(50) , network VARCHAR(20) , points INT ,
`card number` VARCHAR(100) , gender VARCHAR(1));
LOAD DATA LOCAL INFILE 'path/to/dsv'
INTO TABLE tmp_import
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n';
DELETE FROM tmp_import WHERE record_number = 0;
-- select * from tmp_import;
INSERT INTO tUSER (id_number ,first_names,last_name)
SELECT id_number, `first name`, `last name`
FROM tmp_import;
INSERT INTO tTYPES (`type` ,cellphone , description)
SELECT network, `msisdn`, `gender`
FROM tmp_import;
and how can i grab each id (PK) from both tables after inserting , and store them into an associative array to insert them later to the many to many bridge table , this could be totally off your suggestions are welcomed .