SELECT A.FIRMNBR
FROM TA_ALARM_D A, TA_RATE_D B
WHERE B.PRODUCTID = A.PRODUCTID
AND B.TRANSTYPE = A.TRANSTYPE
AND B.RATE || ( SELECT OPERATOR FROM TA_ALARM_D C
WHERE C.PRODUCTID = A.PRODUCTID
AND C.TRANSTYPE = A.TRANSTYPE ) || A.RATE
Hi,
In the above query, in the last condition of 'where clause', I want to pass some relational operators
(like '=','<','>' etc.) dynamically from a table column and then parse the main query to get the result records
from the outer main query.
How could i achieve this.
Try this hope this help U
declare
lv_input_str varchar2(100) := '>';
lv_input_sal number := 0;
lv_output_sal number;
begin
execute immediate 'select count(*) from emp where sal ' || lv_input_str || lv_input_sal INTO lv_output_sal;
--dbms_output.put_line('select count(*) from emp where sal ' || lv_input_str || lv_input_sal);
dbms_output.put_line('lv_output_sal >>>' || lv_output_sal);
end;
Bookmarks