Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CURSORS

Status
Not open for further replies.

NitinJain

Programmer
Jun 28, 2002
18
IN
Hello,
For the following function created I am getting the listed error.

Errors for FUNCTION GETPARENTNODES:

LINE/COL ERROR -------------------------------------------------------
22/2 PL/SQL: Statement ignored
22/10 PLS-00382: expression is of wrong type


CREATE OR REPLACE FUNCTION getParentNodes (nodeId NUMBER) RETURN NUMBER IS

CURSOR cr_ParentNodes IS

SELECT parent_node_id
FROM t_arch
WHERE specified_in_dom = 1 AND
child_node_id = nodeId;

parentNodeId cr_ParentNodes%ROWTYPE;
BEGIN

OPEN cr_ParentNodes;

LOOP
FETCH cr_ParentNodes INTO parentNodeId;
EXIT WHEN cr_ParentNodes%NOTFOUND;
END LOOP;

CLOSE cr_ParentNodes;

RETURN parentNodeId;


END getParentNodes;


Can anyone please sort this thing out.

Regards
 
Hai NitinJain,

Actually u should say,

RETURN parentNodeId.parent_node_id;

Hope this works.

Shantha.
 
Your return statement is wrong.You are trying to return cursor whereas you should return a number.

The correct return statement would be:

return parentNodeId.parent_node_id;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top