Looking for some help...
I want to build a stored procedure that I pass in a value and get back 5 fields from a table. It's likely the query would return more than one record when it is called. Can an Oracle SP do this? The text I have seems to indicate it will only return a single row.
I have constructed what appears to be a properly worded SP according the the text I have below:
----------------
PROCEDURE P_LogGrid (
P_PatrolNum IN Number,
P_PatrolRecNum OUT Number,
P_AmendedDT OUT DATE,
P_Location OUT VarChar2,
P_PlComment OUT VarChar2,
P_IncidentRpt OUT Number
) IS
BEGIN
SELECT PatrolRecNum, AmendedDT, Location, PLComment, IncidentRpt FROM PatrolLog
WHERE PatrolNum = P_PatrolNum;
RETURN P_PatrolRecNum, P_AmendedDT, P_Location, P_PlComment, P_IncidentRpt;
END
-----------------
I have not been able to test this yet. Can anyone tell me if this will work, or if I need to change something?
Thanks very much
CraigHartz
CraigHartz
I want to build a stored procedure that I pass in a value and get back 5 fields from a table. It's likely the query would return more than one record when it is called. Can an Oracle SP do this? The text I have seems to indicate it will only return a single row.
I have constructed what appears to be a properly worded SP according the the text I have below:
----------------
PROCEDURE P_LogGrid (
P_PatrolNum IN Number,
P_PatrolRecNum OUT Number,
P_AmendedDT OUT DATE,
P_Location OUT VarChar2,
P_PlComment OUT VarChar2,
P_IncidentRpt OUT Number
) IS
BEGIN
SELECT PatrolRecNum, AmendedDT, Location, PLComment, IncidentRpt FROM PatrolLog
WHERE PatrolNum = P_PatrolNum;
RETURN P_PatrolRecNum, P_AmendedDT, P_Location, P_PlComment, P_IncidentRpt;
END
-----------------
I have not been able to test this yet. Can anyone tell me if this will work, or if I need to change something?
Thanks very much
CraigHartz
CraigHartz