ck_exist.sql
declare found INTEGER:=0; cursor c_exist (lis_name VARCHAR2) is SELECT name FROM v$database WHERE name = lis_name; c1rec c_exist%ROWTYPE; begin IF NOT c_exist%ISOPEN THEN OPEN c_exist('CLOS1'); END IF; FETCH c_exist INTO c1rec; IF c_exist%FOUND THEN dbms_output.put_line('Found'); ELSE dbms_output.put_line('Not found!'); END IF; CLOSE c_exist; end; /