Hi Anusha,
There are multiple ways to achieve this.
- You can use IF ELSE statement in your code and check the values for val1 and val2 and write separate SELECT statements accordingly.
- You can use EXECUTE IMMEDIATE using dynamic SQL statements. Here you can use the string value for the where clause and manipulate the where clause string based on the val1 and val2 values.
Regards,
Ravi