Monday, December 14, 2015

Import Data into table using Toad(sql*loader)

1) Remove the first line (which usually has the column names mentioned) and save the file in the .csv (delimited) format.
2) And make sure the table is created(if it is new) in the database where you are loading this csv file.
3) Make sure you have same number of columns in file and table.
4) Open Toad and connect to the database/schema that you want to load this data in to the table.
5) In Toad -> Database tab -> SQL *Loader Wizard
6) since, we are doing first time. check -> Build control file and Specify fields and then click Next.
7) click Add 
8) load the Input file (that is in csv format). -> choose file of type to -> All files.
9) click OK.
10)click next.
11) make sure you see the columns and data format that need to be here... if not go back and load the corrected file.
12) click next.
13) Under tables tab, click ADD -> select schema name -> table name-> and load method type(insert).
14) click next after confirming the fields.
15) click next.
16) specify the control file and log file name... and the location to be created so that it can be used if you have to do the same thing again.
17) click next.
18) check -> just build the control file and click FINISH. this will create control file for this task.
19) Now check -> Execute now and click FINISH. This will load the data in to the tab le.
20) validate the data in the table. you should be all set.


Hope this helps!!!!!!!!!!!!!!!!!!!!!!!


PostgreSql: Useful Commands-

 1)   ************************* Users ***************************  -- List of users with roles assigned: SELECT usename AS role_name,   CASE...