Rather than doing a SELECT COUNT(*)...
followed by a SELECT ID...
, both against the same table, I suggest you rework this logic as follows:
BEGIN
SELECT ATTRIBUTE_VALUE_ID
INTO MYVAR1
FROM ATTRIBUTE_VALUES A
WHERE A.ATTRIBUTE_VALUE = INPUT_PARAMETER1 AND
ROWNUM = 1;
COUNT_VAR := 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
COUNT_VAR := 0;
MYVAR1 := NULL;
END;
OTHER_PROCEDURE(MYVAR1);
This helps two ways. First, in my experience SELECT COUNT...
is slow, so I try to avoid it whenever possible. Second, this not only saves a second query but lets you take advantage of the standard exception handling built in to PL/SQL.
Share and enjoy.
EDIT: given OP's revelation (in comments to the question, above) that ATTRIBUTE_VALUES.ATTRIBUTE_VALUE is not unique I've updated the code above so that it will not fail if more than one row would be returned.