Hi,
I recently asked on here about creating my first stored procedure, it compiled fine, but unfortunately whilst trying to run it I get this error:
Retrieve Error:ORA-00904: "V_URN": invalid identifier
ORA-06512: at "CONTACT_RETURN", line 23
ORA-06512: at line 1
Here's my stored procedure:
CREATE OR REPLACE
procedure contact_return(
v_urn IN number,
p_cursor OUT SYS_REFCURSOR )
AS
sql_statement VARCHAR2(4000) := '
SELECT URN,
FIRSTNAME,
LASTNAME,
TITLE,
CREATED_DT,
AREA_URN,
MOBILE,
WORK,
EMAIL,
ORG_NAME,
ADDRESS,
POSTCODE,
IN_USE
FROM CONTACT
WHERE urn = NVL(:1,v_urn)';
BEGIN
OPEN p_cursor FOR sql_statement USING v_urn;
end;
I cannot see a problem with it, since v_urn is declared at the top in the brackets.
Does anyone please have any idea why I'm getting this error? I'm at a loss!
Thanks