/*****************************************************************************
*
* Filename         - $Workfile:   allocated_priv_v1.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          - 
*
* Contents         - Live Schema View
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2001
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   allocated_priv_v1.sql  $  $Revision:   1.1  $
*
* Revision History
*
* Note that user tagtrak is many users. For these users the user
* name is entered as the last line in the change description.
*
* $Log:   /pvcsarch/db_ora/db/source/live/views/allocated_priv_v1.svl  $
* 
*    Rev 1.1   21 Jun 2001 15:36:10   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.0   06 Mar 2001 17:33:22   tagtrak
* OR:
* CR:15398
* REV:
* DESC: View for privilege allocation screen
*
*****************************************************************************/
PROMPT Creating view allocated_priv_v1

CREATE OR REPLACE FORCE
VIEW allocated_priv_v1
(agent_code
,user_role_name
,app_priv_name
,app_priv_description
,allocated
) AS
SELECT agent_code, user_role_name, app_priv_name, app_priv_description, 'YES' ALLOCATED
FROM user_role, app_priv 
WHERE (user_role_id, app_priv_id) IN (SELECT user_role_id, app_priv_id FROM user_role_priv)
UNION
SELECT agent_code, user_role_name, app_priv_name, app_priv_description, 'NO'	ALLOCATED
FROM user_role, app_priv
WHERE (user_role_id, app_priv_id) NOT IN (SELECT user_role_id, app_priv_id FROM user_role_priv)
/

