APEX 3.2
Oracle 11
My requirement is to create a GUI process that allows a user to load a .CSV file, which only has 4 columns and may have multiple rows. Then update the data table in the database with the corresponding data from the .CVS file.
CSV file:
ID Number: Field Name: Channel: Analyst:
123456 Title Retail John Smith
123456 City Retail John Smith
Current DB:
ID Number: Field Name: Channel: Analyst:
123456 Title Retail (null)
123456 City (null) (null)
After Update DB
ID Number: Field Name: Channel: Analyst:
123456 Title Retail John Smith
123456 City Retail John Smith
Any ideas or links is appreciated.
Provide a file browse item, upload your files to wwv_flow_files.
Then parse the BLOB content, see this link:
http://christopherbeck.wordpress.com/2012/04/03/parsing-a-csv-file-in-plsql/
The comments are worth a read too. For example, the Alexendria PLSQL utility library is mentioned. This library contains lots and lots of tools which are plsql based, and is worth a damn good look!
http://code.google.com/p/plsql-utils/
Also, further in the comments is shown how to go from blob to clob (so the posted method could be used. Credits to Christopher Beck):
You could output the columns to a global temp table, or to collections, and then do your update-logic on this. (careful with GTT and apex though. No problem as long as you’re in the same session, but if you would for example make this a second process, there is no guarantee that the same session will get used!)