Sample Header Ad - 728x90

Named Parameter Markers in DB2 for z/OS

1 vote
1 answer
1600 views
I have a query where I will be using the same value twice for one of the parameters. This query will be run under IBM Data Studio to see the results. Below is a sample query: SELECT * FROM SYSADM.STATISTICAL_TABLE S WHERE S.END_RECORD_TIMESTAMP BETWEEN CONCAT(?, '-12.00.00.000000') AND CONCAT(?, '-22.00.00.000000'); When run in Data Studio or any similar graphical query building environment I am prompted to enter values for both parameters, even though the values will always be the same for both. Screenshot from IBM Data Studio showing prompts for both markers I believe it is possible to used named parameter markers in other RDBMSes to indicate that the value should only be given once. Example: SELECT * FROM SYSADM.STATISTICAL_TABLE S WHERE S.END_RECORD_TIMESTAMP BETWEEN CONCAT(?:queryDate, '-12.00.00.000000') AND CONCAT(?:queryDate, '-22.00.00.000000'); Is there a way to use named markers in DB2 for z/OS to indicate that the value will be the same so graphical tools only prompt for one input? On queries that have 20+ inputs, this can be time consuming. Is there a better way that I should be doing this?
Asked by Burke9077 (135 rep)
Jul 8, 2015, 06:07 PM
Last activity: Jul 8, 2015, 07:12 PM