-
AD Hoc SQL Parameter
i know that passing parameters in a query would look somethig like this
select * from atlast where city=:city
However how do i pass a parameter that is ad hoc or not compulsory. In other words if I don't care about city i can ignore it and it returns all records
May seem simple but need help
-
A simple, stupid way of doing it would be:
select * from atlast where city=NVL(:city, city)
In this case, you are assuming that if the bind variable is NULL, you need all the rows.
A second approach would be to use dynamic SQL.
HTH.
Cheers!
OraKid.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|