connect-jdbc/data/oracle/ora-startup-scripts/02_create_accounts.sh
#!/bin/sh

sqlplus connect_user/asgard@//localhost:1521/ORCLPDB1  <<- EOF

  DROP TABLE ACCOUNTS PURGE;
  
CREATE TABLE ACCOUNTS (
	ID INT,
	FIRST_NAME VARCHAR(50),
	LAST_NAME VARCHAR(50),
	USERNAME VARCHAR(50),
	COMPANY VARCHAR(50),
 CREATED_DATE VARCHAR(10) ,
          UPDATE_TS TIMESTAMP 
);


  CREATE OR REPLACE TRIGGER TRG_ACCOUNTS_UPD 
  BEFORE INSERT OR UPDATE ON ACCOUNTS 
  REFERENCING NEW AS NEW_ROW
    FOR EACH ROW
  BEGIN
    SELECT SYSDATE
          INTO :NEW_ROW.UPDATE_TS
          FROM DUAL;
  END;
  /
  
insert into accounts (id, first_name, last_name, username, company, created_date) values (1, 'Hamel', 'Bly', 'Hamel Bly', 'Erdman-Halvorson', '2018-08-16');
insert into accounts (id, first_name, last_name, username, company, created_date) values (2, 'Scottie', 'Geerdts', 'Scottie Geerdts', 'Mante Group', '2018-06-10');
insert into accounts (id, first_name, last_name, username, company, created_date) values (3, 'Giana', 'Bryce', 'Giana Bryce', 'Wiza Inc', '2018-04-06');
insert into accounts (id, first_name, last_name, username, company, created_date) values (4, 'Allen', 'Rengger', 'Allen Rengger', 'Terry, Jacobson and Daugherty', '2018-08-03');
insert into accounts (id, first_name, last_name, username, company, created_date) values (5, 'Reagen', 'Volkes', 'Reagen Volkes', 'Feeney and Sons', '2018-09-24');
insert into accounts (id, first_name, last_name, username, company, created_date) values (6, 'Billy', 'Stolz', 'Billy Stolz', 'Kshlerin-Johns', '2018-04-24');
insert into accounts (id, first_name, last_name, username, company, created_date) values (7, 'Lowell', 'Doggerell', 'Lowell Doggerell', 'Stiedemann-Huels', '2018-05-14');
insert into accounts (id, first_name, last_name, username, company, created_date) values (8, 'Marni', 'Wyles', 'Marni Wyles', 'Rolfson, Crooks and Goldner', '2018-09-26');
insert into accounts (id, first_name, last_name, username, company, created_date) values (9, 'Brnaba', 'Gaukrodge', 'Brnaba Gaukrodge', 'Sawayn-Walker', '2018-10-06');
insert into accounts (id, first_name, last_name, username, company, created_date) values (10, 'Carlin', 'Bettaney', 'Carlin Bettaney', 'Jacobi, Kertzmann and VonRueden', '2018-09-16');
insert into accounts (id, first_name, last_name, username, company, created_date) values (11, 'Vick', 'Guerola', 'Vick Guerola', 'Marvin Inc', '2018-05-01');
insert into accounts (id, first_name, last_name, username, company, created_date) values (12, 'Kiley', 'Comoletti', 'Kiley Comoletti', 'Hansen, Tremblay and Eichmann', '2018-01-16');
insert into accounts (id, first_name, last_name, username, company, created_date) values (13, 'Zaneta', 'Louthe', 'Zaneta Louthe', 'Heller-Murazik', '2018-07-19');
insert into accounts (id, first_name, last_name, username, company, created_date) values (14, 'Hubey', 'Housecraft', 'Hubey Housecraft', 'Volkman, Hyatt and Kris', '2018-08-26');
insert into accounts (id, first_name, last_name, username, company, created_date) values (15, 'Vivienne', 'Beadell', 'Vivienne Beadell', 'Legros-Lockman', '2018-10-14');
insert into accounts (id, first_name, last_name, username, company, created_date) values (16, 'Nathalie', 'Kimpton', 'Nathalie Kimpton', 'Jakubowski Inc', '2018-10-12');
insert into accounts (id, first_name, last_name, username, company, created_date) values (17, 'Batsheva', 'Hindes', 'Batsheva Hindes', 'White, Beer and Prohaska', '2018-05-13');
insert into accounts (id, first_name, last_name, username, company, created_date) values (18, 'Darya', 'Leijs', 'Darya Leijs', 'Wunsch, Stark and Mraz', '2017-12-18');
insert into accounts (id, first_name, last_name, username, company, created_date) values (19, 'Jaquith', 'Girdlestone', 'Jaquith Girdlestone', 'Halvorson, Kuphal and Lang', '2018-02-01');
insert into accounts (id, first_name, last_name, username, company, created_date) values (20, 'Lilllie', 'MacIlriach', 'Lilllie MacIlriach', 'Waters-McDermott', '2018-04-01');

EOF
