In a Pro*C file, I have a very straightforward anonymous PL/SQL block like this:
EXEC SQL EXECUTE
DECLARE
nrows pls_integer := 0;
BEGIN
select count(*) into nrows from tbl;
if nrows != 1 then
RAISE_APPLICATION_ERROR(-20000,
'The table must contain exactly one row');
else
select stuff into :stuff FROM tbl;
end if;
END;
END-EXEC;
Pro*C protests with:
CSF-S-00201, identifier 'RAISE_APPLICATION_ERROR' must be declared
However, moving the anonymous PL/SQL block to the SQL developer (and adding a stuff variable):
DECLARE
nrows pls_integer := 0;
stuff NUMBER := 0;
BEGIN
select count(*) into nrows from tbl;
if nrows != 1 then
RAISE_APPLICATION_ERROR(-20000,
'The table must contain exactly one row');
else
select stuff into :stuff FROM tbl;
end if;
END;
/
works fine. What could be going on? The schema I’m using to compile the Pro*C file and to execute the block in SQL developer is the same.