PROMPT Create view transaction_id

CREATE OR REPLACE VIEW transaction_id AS
	SELECT * 
	FROM dwh.transaction_id_tab
	UNION
	SELECT * 
	FROM bagmis.transaction_id_tab
	UNION
	SELECT * 
	FROM wstmt.transaction_id_tab
	WITH READ ONLY;
	
	
CREATE OR REPLACE VIEW TRANSACTION_JOB AS
	SELECT * 
	FROM dwh.transaction_job_tab
	UNION
	SELECT * 
	FROM bagmis.transaction_job_tab
	UNION
	SELECT * 
	FROM wstmt.transaction_job_tab
	WITH READ ONLY;

PROMPT Create view v_prm_user

CREATE OR REPLACE VIEW v_prm_user AS
SELECT u.kd_user                    kd_user,
       u.nama_user                  nama_user,
       u.password                   password,
       u.kd_cabang                  kd_cabang,
       u.kd_status                  kd_status,
       u.chg_pass                   chg_pass,
       u.last_change_pass           last_change_pass,
       a.kd_group                   kd_group,
       g.nama_group                 nama_group,
	   b.branch_code                branch_code
FROM prm_user@syslogin u,
     prm_user_access@syslogin a,
     prm_group@syslogin g,
	 branch_access@syslogin b
WHERE u.kd_user = a.kd_user
AND a.kd_group = g.kd_group
AND a.kd_apps = (SELECT l.paramvalue FROM prm_system l WHERE l.paramid = 'APPSID')
AND a.kd_user = b.kd_user(+)
AND a.kd_apps = b.kd_apps(+)
WITH READ ONLY
/