I am trying to create function in PL/SQL but I am getting invalid identifier error
( for username VARCHAR2) and
"In a procedure, RETURN statement cannot contain an expression" error.
I tried similar questions solutions about invalid identifer and return statemnt error but noone of them worked for me.
I couldn't fix the issue . Idk what's the reason for throwing error.
I am using oracle 19c with oracle sql developer
Can you help me ? Thanks in advance
My create function code :
CREATE OR REPLACE FUNCTION bring_product
(
username VARCHAR2
)
RETURN pr%ROWTYPE
AS
product_tbl pr%rowtype;
BEGIN
SELECT * INTO product_table FROM PRODUCT pr WHERE pr.kulusername = username ;
RETURN product_tbl ;
END;
You cannot use a
table aliasfor variable declaration of%rowtypeattribute-stylebut the
table name. So, convert to the following one :