I would like to fire off an oracle stored procedure in a ASP.NET page that I will pass a query parameter (string variable) to assign to a where clause. I am concatenating the string to the rest of the SQL statement and would like to execute it. Do I use the EXEC() command? I would also like to query other tables based on an id from the first query. So, far this will not compile.
I would like to take the Tribal ID from the first query to run in a second query for retrieving a second dataset of tribal information. I have not written the 2nd query yet since I just wanted to fix the first compile error so that I can at least retrieve the first dataset. Is this possible to do in an oracle stored procedure?
Code:
CREATE OR REPLACE PROCEDURE GetTribeInfo (qryParam STRING) AS
strSQL VARCHAR2(100);
BEGIN
/* Get Tribes by Selected Counties */
strSQL := 'SELECT TRIBAL_ID, TRIBAL_NAME, COUNTY_NAME, STATE_NAME
FROM TRIBE_COUNTY_VW
WHERE (COUNTY_ID =' || qryParam || 'ORDER BY COUNTY_NAME';
EXEC(strSQL)
/* Get Tribes by Selected Counties */
--SELECT TRIBAL_ID, TRIBAL_NAME, COUNTY_NAME, STATE_NAME
--FROM TRIBE_COUNTY_VW
--WHERE (COUNTY_ID = || qryParam
--ORDER BY COUNTY_NAME
/* Get Tribe Information */
/*--SELECT
--FROM VwAuthors
--WHERE exists (Select * from Titles where au_id = VwAuthors.au_id)
--ORDER BY title_id*/
END;
I would like to take the Tribal ID from the first query to run in a second query for retrieving a second dataset of tribal information. I have not written the 2nd query yet since I just wanted to fix the first compile error so that I can at least retrieve the first dataset. Is this possible to do in an oracle stored procedure?