How to search for selected items in a drop down list or compo box
The selected items string should be in the following format
(first item,second item,third item,….)
Then you can use the SQL (IN clause) to retrieve the data
For some reason in ORACLE SQL, you should make the select statement as string to make it work else you will get no thing while if you are using sql server you don’t need to do that
See the following stored procedure
CREATE OR REPLACE PROCEDURE SP_Search_Emp(
ESTATUS IN VARCHAR2,ETYPE IN VARCHAR2,CUR_E_STATUS_TYPE OUT SYS_REFCURSOR )
AS
STR_ESTATUS VARCHAR2(9000);
STR_ETYPE VARCHAR2(9000);
CS VARCHAR2 (15000);
BEGIN
Select ''''Replace(ESTATUS,',',''',''')'''' into STR_ESTATUS from dual;
Select ''''Replace(ETYPE,',',''',''')'''' into STR_ETYPE from dual;
cs:='SELECT e.emp_id,e.emp_name,e.emp_address,e.emp_salary,e.emp_status,e.emp_type
FROM Emp_table e
WHERE emp_Status IN';
cs := cs '('upper(STR_ESTATUS)') AND emp_type IN (' str_etype')
)';
open cur_E_status_type for cs;
END SP_Search_Emp;
No comments:
Post a Comment