/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2008 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  --
  -- Tests if the install row already exists
  --
  CURSOR csr_inst_exists IS
  SELECT 'Y'
  FROM   xxas_com_install ai;

  --
  -- Local variables
  --
  l_exists varchar2(1)   := 'N';
  l_schema varchar2(400) := '&1';

BEGIN

  --
  -- See if the install row already exists
  --
  OPEN  csr_inst_exists;
  FETCH csr_inst_exists INTO l_exists;
  CLOSE csr_inst_exists;

  --
  -- If the install row does not already exist, create it
  --
  IF l_exists = 'N' AND l_schema IS NOT NULL THEN
    INSERT INTO xxas_com_install
      (install_date
      ,custom_schema)
    VALUES
      (sysdate
      ,l_schema);
  END IF;

END;
/
COMMIT;
EXIT;
