--THIS FILE IS NEEDED ONLY FOR THE ONLINE UPDATE OR WHEN UPGRADING FROM VERSION 8.9.0.5!!!

DECLARE  CNT   NUMBER(10);
BEGIN
    SELECT COUNT(*) INTO CNT FROM WRDQ WHERE WRDQ_ALIAS='OLDOWNER';    
        IF (CNT = 0) THEN
          INSERT INTO WRDQ(WRDQ_ID,WRDQ_ROLE, WRDQ_QUERY, WRDQ_ALIAS, WRDQ_RUNORDER)VALUES
             (
                 SEQ_WRDQ.NEXTVAL,
                 33,
                 'Select LTRIM(xcms_name3 || '' '' || LTRIM(xcms_name2 || '' '' || xcms_name1 )) as EMPNAME from xcms where xcms_id =:OLDOWNER_ID',
                 'OLDOWNER',
                 (SELECT COUNT(*) + 1  AS RUNORDER  FROM WRDQ WHERE WRDQ_ROLE= 33) 
             );       
        END IF;    
END;
/
