Need to import 60+ CSVs to separate tables (can I bulk import or loop?)
Hi all,
I have 60+ CSV files which I would like to create to a separate table.
To make things easier, let's say that these are named 1, 2, 3, 4, .... n.
I am currently using Oracle SQL Developer.
Is there a way to write a script or perform a bulk create so that I create different tables (i.e. 1, 2, 3, 4, ... n)?
Because I'm thinking it would be very time consuming to use the normal 'import data' function for each file... also there is a possibility that more files need to be loaded.
Otherwise, is it possible to write some sort of 'script' which references a directory on my hard drive and then loops through to create the tables as well?
Would be great if anyone could point me to some reference materials.
Thanks
I agree with Hoek, if the structure of the files is the same, then just use a single External Table definition and use the Alter Table statement to change the "location" (which is the filename) dynamically at run-time before you then query the file and insert the contents into your table(s).
http://www.morganslibrary.org/reference/externaltab.html
Example:
I have a file on my server in a folder c:\mydata called text.csv which is a comma seperated file...
1,"Fred",200
2,"Bob",300
3,"Jim",50As sys user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS "c:\mydata";
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser;Note: creates a directory object, pointing to a directory on the server and must exist on the server (it doesn't create the physical directory).
As myuser:
SQL> CREATE TABLE ext_test
2 (id NUMBER,
3 empname VARCHAR2(20),
4 rate NUMBER)
5 ORGANIZATION EXTERNAL
6 (TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY TEST_DIR
8 ACCESS PARAMETERS
9 (RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ","
11 OPTIONALLY ENCLOSED BY '"'
12 (id,
13 empname,
14 rate
15 )
16 )
17 LOCATION ('test.csv')
18 );
Table created.
SQL> select * from ext_test;
ID EMPNAME RATE
1 Fred 200
2 Bob 300
3 Jim 50
SQL>
{code}
And to alter the location...
{code}
SQL> begin
2 execute immediate 'alter table ext_test location(''test'||to_char(sysdate-1,'YYYYMMDD')||'.csv'')';
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1* select dbms_metadata.get_ddl('TABLE', 'EXT_TEST', USER) from dual
SQL> /
DBMS_METADATA.GET_DDL('TABLE','EXT_TEST',USER)
CREATE TABLE "SCOTT"."EXT_TEST"
( "ID" NUMBER,
"EMPNAME" VARCHAR2(20),
"RATE" NUMBER
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "TEST_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
(id,
empname,
rate
LOCATION
( 'test20101214.csv'
)Edited by: BluShadow on 17-Apr-2013 08:31
to add example
Similar Messages
-
I need to import data from a CSV file to an Oracle table
I need to import data from a CSV file to an Oracle table. I'd prefer to use either SQL Developer or SQL Plus code.
As an example, my target database is HH910TS2, server is ADDb0001, my dB login is em/em, the Oracle table is AE1 and the CSV file is AECSV.
Any ideas / help ?And just for clarity, it's good to get your head around some basic concepts...
user635625 wrote:
I need to import data from a CSV file to an Oracle table. I'd prefer to use either SQL Developer or SQL Plus code.SQL Developer is a GUI front end that submits code to the database and displays the results. It does not have any code of it's own (although it may have some "commands" that are SQL Developer specific)
SQL*Plus is another front end (character based rather than GUI) that submits code to the database and displays the results. It also does not have code of it's own although there are SQL*Plus commands for use only in the SQL*Plus environment.
The "code" that you are referring to is either SQL or PL/SQL, so you shouldn't limit yourself to thinking it has to be for SQL Developer or SQL*Plus. There are many front end tools that can all deal with the same SQL and/or PL/SQL code. Focus on the SQL and/or PL/SQL side of your coding and don't concern yourself with limitations of what tool you are using. We often see people on here who don't recognise these differences and then ask why their code isn't working when they've put SQL*Plus commands inside their PL/SQL code. ;) -
How do I import one xml file into 3 separate tables in db?
I need to utilize xslt to import one xml file into 3 separate tables: account, accountAddress, streetAddress
*Notice the missing values in middleName, accountType
sample xml
<account>
<firstName>Joe</firstName>
<middleName></middleName>
<lastName>Torre</lastName>
<accountAddress>
<streetAddress>
<addressLine>myAddressLine1</addressLine>
<addressLine>myAddressLine2</addressLine>
</streetAddress>
<city>myCity</city>
<state>myState</state>
<postalCode>mypostalCode</postalCode>
</accountAddress>
<accountId>A001</accountId>
<accountType></accountType>
<account>
I need the following 3 results in 3 separate xml files in order for me to upload into my 3 tables.
Result #1
<rowset>
<row>
<firstName>Joe</firstName>
<lastName>Torre</lastName>
<accountId>A001</accountId>
<row>
<rowset>
Result #2
<rowset>
<row>
<addressId>1</address>
<city>myCity</city>
<state>myState</state>
<postalCode>myPostalCode</postalCode>
<row>
<rowset>
Result #3
<rowset>
<row>
<addressId>1</addressId>
<addressLineSeq>1</addressLineSeq>
<addressLine>myAddressLine1</addressLine>
<row>
<row>
<addressId>1</addressId>
<addressLineSeq>2</addressLineSeq>
<addressLine>myAddressLine2</addressLine>
<row>
<rowset>Use XSU to store in multiple tables.
"XSU can only store data in a single table. You can store XML across tables, however, by using the Oracle XSLT processor to transform a document into multiple documents and inserting them separately. You can also define views over multiple tables and perform insertions into the views. If a view is non-updatable (because of complex joins), then you can use INSTEAD OF triggers over the views to perform the inserts."
http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14252/adx_j_xsu.htm#i1007013 -
Excel issues with importing CSV or HTML table data from URL - Sharepoint? Office365?
Greetings,
We have a client who is having issues importing CSV or HTML table data as one would do using Excel's Web Query import from a reporting application. As the error message provided by Excel is unhelpful I'm reaching out to anyone who can help us begin to
troubleshoot problems affecting what is normal standard Excel functionality. I'd attach the error screenshot, but I can't because my account is not verified....needless to say it says "Microsoft Excel cannot access the file https://www.avantalytics.com/reporting_handler?func=wquery&format=csv&logid=XXXX&key=MD5
Where XXXX is a number and MD5 is an md5 code. The symptoms stated in the error message are:
- the file name or path does not exist
-The file is being used by another program
-The workbook you are trying to save has the same name as a currently open workbook.
None of these symptoms are the case, naturally. The user encountered this with Excel2010, she was then upgraded to Excel2013 and is still experiencing the same issue. The output of this URL in a browser (IE, Chrome, Firefox) is CSV data for the affected
user, so it is not a network connectivity issue. In our testing environment using both Excel2010 or 2013 this file is imported successfully, so we cannot replicate. The main difference I can determine between our test environment and the end-user
is they have a Sharepoint installation and appear to have Office365 as well.
So, my question might more appropriately be for Sharepoint or Office365 folks, but I can't be sure they're a culprit. Given this - does anyone have any knowledge of issues which might cause this with Sharepoint or Office365 integrated with
Excel and/or have suggestions for getting more information from Excel or Windows other than this error message? I've added the domain name as a trusted publisher in IE as I thought that might be the issue, but that hasn't solved anything. As you
can see its already https and there is no authentication or login - the md5 key is the authentication. The certificate for the application endpoint is valid and registered via GoDaddy CA.
I'm at a loss and would love some suggestions on things to check/try.
Thanks -RossHi Ross,
>> In our testing environment using both Excel 2010 and 2013 this file is imported successfully, so we cannot replicate.
I suspect it is caused by the difference of web server security settings.
KB: Error message when you use Web query to a secure Web page (HTTPS://) in Excel: "Unable to open"
Hope it will help.
By the way, this forum is mainly for discussing questions about Office Development (VSTO, VBA and Apps for Office .etc.). For Office products feature specific questions, you could consider posting them on
Office IT Pro forum or Microsoft Office Community.
Regards,
Jeffrey
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Need to merge a csv file using external tables into a main table
Hi,
I have a csv file which contains the date(with time stamp), column1(number),column2(number), column3 (number). I am using external tables concept to load the data froom csv to this external table and then merging into the main table. Problem here is : the csv file is a system generated file and nothing can be edited under it. our aim is to automate this process of loading data from csv to the table. In this csv the date time stamp is not in the proper format.I mean the date is not visible and only minutes and seconds are visible.By changing the format in csv manually this can be overcome.but we donot need any manual intervention.
how can i overcome this problem ?? please help mee...
Excels data looks like:
(PDH-TSV 4.0) (India Standard Time)(-330) \\DISAPPSER01\Processor(_Total)\% Privileged Time \\DISAPPSER01\Processor(_Total)\% Processor Time \\DISAPPSER01\Web Service(_Total)\Current Connections
56:59.0 47
57:09.0 0.72379582 4.204561281 46
57:19.0 0.916548537 4.006179927 44
57:29.0 0.663034771 3.674662541 43
57:39.0 0.750789844 4.093933999 42
57:49.0 0.721538487 2.650858026 40
57:59.0 0.594781604 3.333393703 40please format your sample data giving header to the column so that we can make sense out of the values, also since the minutes and seconds are only given, what is the date to be considered for records to be moved to the master table, sysdate or will the date be passed as a parameter?
-
Help with scripting: need to import Excel files into PS type layers
Howdy all,
I have a series of TV commercials provided to me as layered PS files. I work in CS3 and export to Avid for editing.
For customization, I need to import their Excel list of phone numbers and duplicate each one into a type layer with existing efx and placement.
There are 30-60 #s, which appear in 2 locations, so automation is key (just finished a 45 # series, and they have more!)
I dont know how to script this, and would appreciate any guidance. I am not asking for someone to do it for me, just help me learn what I have to do.
Dave KoslowFrom Excel save your file out as either CSV or TDT from the drop down 'save as' options. Once you have a plain text file script will be able to read the text file using which ever delimiter best suits you and create an array of string variables that you can use within photoshop to assign to the contents of a text layer…
-
Help needed in Loading excel data to staging table from OAF Page
Hi All,
We have a requirement from the client on loading of a excel sheet data into staging table using OAF page.
We were able to load a CSV file into staging table via OAF. The approach we used is we created a item of style 'messageFileUpload', which would pick the CSV file from desktop and we wrote the logic on the controller to place the file into server and then sumit a concurrent program to load the data into the staging table.
But client wants data from the excel file to be loaded into staging table. Is there any way(approach) by which we can convert the excel file data into .CSV file using OAF?
Any help or pointers on this will be highly apperciated.
Thanks,
ChethanaHi,
Read through this :
Need to upload a CSV/Excel to a table in OAF page
Thanks,
Gaurav -
Need to fill a new field in table EKKO
Hi all,
i created a new field (ZZCODE) in the table EKKO. Well, now i would like to fill this field when the user save his purchase order. Which user-exit or BADI can i use ?
I tried a lot but either i can't change the parameters values either the FM is not raise.
Thanks for help.HI CECG,
Yesterday itself i tried this example,
i will forward u the document to ur mail id,
plz provide me the mail id so that i will forward u the doc..
STEP-BY-STEP PROCEDURE FOR SCREEN EXIT IN ME21n TRANSACTION
Introduction:
SAP provides standard transactions to enter data into database. But a client may want to maintain some additional information in SAP other than what is provided.
To make provisions for this, additional screens have to be provided and additional fields must be added into appropriate database table.
Requirement:
You have to add the custom field in SAP standard table EKKO. Then we have to place the field in ME21N screen. When user enters any input into the field it should get updated in the database.
Note:
EKKO table is meant for Purchasing document header, you should add the field in the header level for ME21n screen. There you are provided with customer sub screens where you can add the field in the screen.
In EKKO table
include : cl_ekkodb
in that u can add the field u want
Procedure:
1. You have to create a field in the Custom Include of standard table, after creating activate it.
2. Double click on the include then you can add your custom field here.
Find out the Required Enhancements:
1. Go to SMOD. Press F4 in the Enhancement field. In the next popup window, click pushbutton Information system.
MM06E005 : CUSTOMER FIELDS IN PURCHASING DOCUMENT
2. Then mention the particular package name of the transaction you need to enhance. Then you will be shown the list of Enhancement components for that particular package.
3. Note down the enhancements. Then, come to the initial screen of SMOD and view the documentation of each enhancement to find out which one is required for your development.
MM06E005 is the Enhancement component we are using here.
Development
Creating a Project to include the enhancement:
1. Go to transaction CMOD and create a project.
2. Enter a description for the project.
3. Then, click on the pushbutton Enhancement Assignments in the Application Toolbar.
4. Click on the components in Application Toolbar.
5. Here you will be shown the function module exits, screen exits and Include tables.
6. Click on the custom screen SAPLXMO6 0101 in which it suits the requirement of adding the custom field to the layout.
7. Click on layout and go to get from dictionary and select the field you need to add and click ok.
8. Place the field in the layout and activate it.
9. After that you come back and check the respective function module in which you need to implement the code. So, we need to import the data from sub screen for purchasing document header. Therefore we have chosen the EXIT_SAPMM06E_008.
10. Write code in the Function Exits to synchronize the programs:
Now, code has to be written in the function modules EXIT_SAPMM06E_008 so that data flows to and fro between the main SAP program and custom sub screen program. Double clicking on the exit we get the following screen.
11. Double click on the include and write the required code inside it. Then activate it.
12. Now come back and activate the entire project.
13. Now go to ME21n transaction and create a purchase order by giving all the mandatory fields including custom field we have created. Go to SE16n, check whether the field got updated in the database or not.
Finally it gets updated in the database.
IF U PROVIDE ME UR MAILID I CAN SEND U THE DOCUMENT WHICH IS VERY CLEAR FOR PURCHASE ORDER
PLZ REWARDS POINTS IF HELPFUL,
Ganesh. -
I just downloaded trial version -- don't see iPhoto library in Aperture and need to import selected photos to edit, not entire i Photo library! I read manual and it says:
Browsing and Selecting Images in Your iPhoto Library
You use the Aperture iPhoto Browser to review iPhoto images and import specific images into the Aperture library. The iPhoto Browser gives you a handy way of looking for certain images without having to import your entire iPhoto library.
So, where do I review the iPhoto images...there is nothing in there that says "iPhoto Library" Everything I see pertains to Aperture Library which of course is empty since I haven't imported (or dragged) any photos in there yet.
Also is tech support available for Aperture? I have Apple Extended Support and I sure would love it if I had individual help. I have a deadline --3 days to edit 300 photos and I'm a complete amateur. iPhoto doesn't have the capability to erase parts of a face (I need to contour the neck of a mannequin to make it proportionate to the separate head I put on top of it. I'm sure Aperture must have a tool to help me do that! At least I hope so.where do I review the iPhoto images
File -> Import -> Show iPhoto Browser
I have a deadline --3 days to edit 300 photos and I'm a complete amateur. iPhoto doesn't have the capability to erase parts of a face (I need to contour the neck of a mannequin to make it proportionate to the separate head I put on top of it. I'm sure Aperture must have a tool to help me do that!
Sounds more like a job for Photoshop to me
if I decide to import entire iPhoto library into Aperture will it delete my iPhoto library?
No.
Regards
TD -
Separate table title autonumbering for two named table styles?
I believe this very same question whizzed by a few weeks ago but I'm having no luck searching for it.
I have two named table styles. I want the autonumbering for the table titles to be separate. More specifically, one will autonumber as "Table t", while the other will autonumber as "Example e".
I have redefined the autonumbering counter for the second of the two TableTitle para style, and if I apply that style while in that table's title, I get the new autonumbering. But I can't transmit (a) selectively update the Table Title style to this format to other tables in the chapter. By extension, I can't copy the wonderful new table format to other chapters in the book.
I next tried creating a new para style "ExampleTitle", then in the Table Designer trying Update All. Nope, other tables of type example do not receive the new title style.
This is fully-patched FM8. The document is structured but I don't (want to) care about that -- I simply need to get the two different named table styles
to autonumber sequentially.
This is probably pretty easy once I learn the "trick"...(?)
Cheers & thanks,
RileyArnis:
Thanks. For some reason I couldn't get my table to update, so I went through and manually create a second table title paragraph style, then manually applied that. (I also created a second x-ref format so that I could x-ref to "Example n:" without including the colon in the x-ref, but that's another story...)
So for now I've worked around the problem. After I get this document out I'll revisit the issue. (Why do I have a vague recollection that there's a known idiosyncracy where FM6+ table styles don't update properly...?)
Cheers & thanks 'gain,
Riley -
Will there performance improvement over separate tables vs single table with multiple partitions? Is advisable to have separate tables than having a single big table with partitions? Can we expect same performance having single big table with partitions? What is the recommendation approach in HANA?
Suren,
first off a friendly reminder: SCN is a public forum and for you as an SAP employee there are multiple internal forums/communities/JAM groups available. You may want to consider this.
Concerning your question:
You didn't tell us what you want to do with your table or your set of tables.
As tables are not only storage units but usually bear semantics - read: if data is stored in one table it means something else than the same data in a different table - partitioned tables cannot simply be substituted by multiple tables.
Looked at it on a storage technology level, table partitions are practically the same as tables. Each partition has got its own delta store & can be loaded and displaced to/from memory independent from the others.
Generally speaking there shouldn't be too many performance differences between a partitioned table and multiple tables.
However, when dealing with partitioned tables, the additional step of determining the partition to work on is always required. If computing the result of the partitioning function takes a major share in your total runtime (which is unlikely) then partitioned tables could have a negative performance impact.
Having said this: as with all performance related questions, to get a conclusive answer you need to measure the times required for both alternatives.
- Lars -
Processing a .CSV file to Table
HI Friends,
Please le tme know how to process a .CSV file to Table by using SQL loader Concept.
No other technique required...! Know it can be done thru various processes. But needed in the above way...
Thanks in adv...!
tempdbs
www.dwforum.nethere:
http://forums.oracle.com/forums/search.jspa?threadID=&q=loading+csv+sql+loader&objID=c84&dateRange=lastyear&userID=&numResults=15 -
How do I make data from one Table flow into a separate Table
How do I make data from one Table flow into a separate Table in iworks numbers?
Great stuff Yvan,
KOENIG Yvan wrote:
Here you may see the way to transfer the contents of a column of Table A in a column of Table B
I used two kinds of formulas.
In the cell A2 of Table B
the formula is :
=Table A :: $B2
It may be :
=Table A :: $B
Apply Fill Down
Copy paste it in cell A1 which is in a header row.
This formula does its duty but it’s not robust enough and will not survive to a Sort.
This is why in B2, I inserted a more robust formula :
=OFFSET(Table A :: $A$1,ROW()-1,2)
You will find details about the functions used in Numbers User Guide delivered with every copy of iWork ‘08
Yvan KOENIG (VALLAURIS, France) samedi 6 août 2011 17:45:22
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !
The first suggestion was the simple answer I needed,
Thank you -
How to summary a field from 2 separate tables but having the same fields
Post Author: thuyvd78
CA Forum: General
Hi, I am getting trouble with creating the summary from 2 separate tables. These tables dont have any link together but they have the same fields, such as: part id, qty, etc. I need to create a report that displays whole the information from these tables and also the summary of total qty field of these tablesAny idea to organize this report? Thank you very much! ThuyPost Author: thuyvd78
CA Forum: General
Thank you for your help v361.where can I can get the link to download samples for subreport from official website?And can I use FULL INNER query to join these tables. I think this way is much clearer than using subreport but not sure it will work? Thanks Thuy -
PROBLEM - I need to import Attr with more than 20 char.
Hi,
I need to import some text information.
My first idea was to import them via Attribute (Attr) field. Unfortunately they are cut after 20 chars.
Next workaround was to import into a non-used dimension (UD8 - UD 15): here the problem is, that there is no matching dimension in the target system. FAILED
Also, trying to import in a dimension (USE AS LOOKUP) (via integration script) - that don't need to have a matching dimension in the target system - FAILED
Are there any workarounds how script a integration script that imports the text information from a CSV file into e. g. unused dimension columns??
Other workarounds?
HELP - I'm lost :-)
regards
HauTony,
added additional dimensions (enabled , not "use as lookup") -> done
unchecking the use list box -> done
how should the load rule look like. to pass them successful int essbase?
up to now:
import -> works
validate (like *) -> works
export -> :-( doesnt work
I'm lost again...
Maybe you are looking for
-
I just went to the apple store to replace my Ipod Touch yesterday. There I began the process of restoring my Ipod. When I got home to continue doing it my apps werent downloading, they just read waiting... So I decided to stop the restoring and my ap
-
Hi I've upgrated an old PowerBook G4 from osx 10.3 to 10.5. Now my old Logic 7 can't initialize the CoreAudio and won't start up. Any good ideas why?
-
When I try to upload pictures onto iPhoto, it shows up, however it won't upload. The "import" button, I can't click on it. It won't upload. And when I want to close out the window of iPhoto, it won't close, I get a message saying "photos being upload
-
Is there anything like Easy Wifi Radar for mac?
I saw a cool app for windows called easy wifi radar. Is there anything like it for mac, in terms of interface, and idea?
-
Dear All, I have created new tax code called I2, but at the time of posting of vendor invoice its throwing error Message No. F5341. Regards, Sonal