I want to include the following SQL in a procedure:
SELECT COUNT(*)
FROM SYS.DBA_OBJECTS
WHERE OBJECT_TYPE = 'DATABASE LINK'
When i run this SQL outside the procedure, the SQL is successful. When I include the same SQL in a procedure, I get ORA-00942: table or view does not exist. Inside the procedure, I have tried the FROM statement both with and without SYS. and have tried double quotes around "SYS" "DBA_OBJECTS" together and separately. In all cases, the SQL runs outside the procedure but not within it.
Any ideas what I'd need to do to get this SQL to run in a procedure?
Thanks, Edward