I am needing to create a SELECT statement that will count the number of rows with the username given in an input statement in a table called UserPermissions. The number of rows will then need to be returned and if there isnt any then I need username not found.
Here is my code so far:
CREATE or REPLACE FUNCTION user_documents_func (UserName varchar2)
RETURN int AS
BEGIN
IF num_views > 0 THEN
RETURN UserName || ' can view ' || num_views || ' document(s).';
ELSE
RETURN 'Username not found!';
END IF;
END;
/
SET SERVEROUTPUT ON;
Aucun commentaire:
Enregistrer un commentaire