Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. 1|john|email@email.email|active
  2.  
  3. load data infile `"C:path"
  4. insert into table users
  5. fields terminated by "|"
  6. lines terminated by "rn";
  7.  
  8. [oracle@testsrv1 Desktop]$ cat user.tbl
  9. 1|john|email@email.com|active
  10. [oracle@testsrv1 Desktop]$ sqlplus / as sysdba
  11.  
  12. SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 3 06:45:26 2016
  13.  
  14. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  15.  
  16.  
  17. Connected to:
  18. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  19. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  20. and Real Application Testing options
  21.  
  22. SQL> create user user1 identified by user1;
  23.  
  24. User created.
  25.  
  26. SQL> create directory user_dir as '/home/oracle/Desktop';
  27.  
  28. Directory created.
  29.  
  30.  
  31. SQL> grant resource, connect to user1;
  32.  
  33. Grant succeeded.
  34.  
  35. SQL> grant read, write on directory user_dir to user1;
  36.  
  37. Grant succeeded.
  38.  
  39. SQL> conn user1/user1
  40. Connected.
  41.  
  42. SQL> create table user_load(user_id number, name varchar2(20), email varchar2(50), status varchar2(10))
  43. organization external
  44. (default directory user_dir
  45. access parameters
  46. (fields terminated by '|')
  47. location('user.tbl')
  48. );
  49.  
  50. Table created.
  51.  
  52. SQL> select * from user_load;
  53.  
  54. USER_ID NAME EMAIL STATUS
  55. ---------- ---------- ------------------- ----------
  56. 1 john email@email.com active
  57.  
  58.  
  59. SQL> create table final as select * from user_load;
  60.  
  61. Table created
  62.  
  63. SQL> select * from final;
  64.  
  65. USER_ID NAME EMAIL STATUS
  66. ---------- ---------- ------------------- ----------
  67. 1 john email@email.com active
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement