I have framed the following procedure to find out whether the parameter that is being passed to the procedure exists in the ID column of a table or not:
CREATE OR REPLACE PROCEDURE ExistsOrNot(
iID INT)
IS
intID INT;
BEGIN
SELECT ID INTO intID FROM tblName WHERE ID=iID;
IF EXISTS(intID) THEN
DBMS_OUTPUT.PUT_LINE('ID EXISTS');
ELSE
DBMS_OUTPUT.PUT_LINE('ID DOES NOT EXIST');
END IF;
END;
but the above throws a compilation error saying Encountered the symbol "INTID" when expecting one of the following :
( select
Where am I going wrong? I know that NO_DATA_FOUND can be used in this case but I would like to know how do I make use of EXISTS to do the same.
Thanks,
Arpan
CREATE OR REPLACE PROCEDURE ExistsOrNot(
iID INT)
IS
intID INT;
BEGIN
SELECT ID INTO intID FROM tblName WHERE ID=iID;
IF EXISTS(intID) THEN
DBMS_OUTPUT.PUT_LINE('ID EXISTS');
ELSE
DBMS_OUTPUT.PUT_LINE('ID DOES NOT EXIST');
END IF;
END;
but the above throws a compilation error saying Encountered the symbol "INTID" when expecting one of the following :
( select
Where am I going wrong? I know that NO_DATA_FOUND can be used in this case but I would like to know how do I make use of EXISTS to do the same.
Thanks,
Arpan