DECLARE
  COUNT_INDEXES INTEGER;
  BEGIN
    SELECT COUNT(*) INTO COUNT_INDEXES
      FROM USER_INDEXES
      WHERE INDEX_NAME = 'IDX_ATH';

    IF COUNT_INDEXES > 0 THEN
      EXECUTE IMMEDIATE 'DROP INDEX IDX_ATH';
    END IF;
  END;
  /

DECLARE
  COUNT_INDEXES INTEGER;
  BEGIN
    SELECT COUNT(*) INTO COUNT_INDEXES
      FROM USER_INDEXES
      WHERE INDEX_NAME = 'IDX_AUTHORIZATION_CODE_HASH';

    IF COUNT_INDEXES > 0 THEN
      EXECUTE IMMEDIATE 'DROP INDEX IDX_AUTHORIZATION_CODE_HASH';
    END IF;
  END;
/
CREATE INDEX IDX_ATH ON IDN_OAUTH2_ACCESS_TOKEN(ACCESS_TOKEN_HASH)
/
CREATE INDEX IDX_AUTHORIZATION_CODE_HASH ON IDN_OAUTH2_AUTHORIZATION_CODE (AUTHORIZATION_CODE_HASH,CONSUMER_KEY_ID)
/