Search This Blog

Friday, May 3, 2013

Dynamic SQL Creation - A Shortcut

It is often seen in Payroll projects to create a run control page with company, business unit, department combination and the reports need to be run with any of the above combinations.

The way I have seen a lot of people doing is to create a dynamic SQL based on the parameter check. 

Which you can easily do with the DECODE function. 

The screenshot from a SQR program given below. You can use the same in SQL.

Will be a handy tip for beginners.

No comments:

Post a Comment