ibm midrange - To function or not to function, that is the question at hand -


i working on sql statements asp.net application. 1 of things required display information in open period. period updated automatically vendor software previous period closed. finding myself doing bunch of sub selects like:

where date >= (select date(concat('20', concat(yy, concat('-', concat( mm, (concat('-', dd))))))) lib/file')  

yes, each portion of date in separate fields.

would making query function make query more efficient? have never created function before how that? thought having like:

isinrange(date) 

so can where isinrange(date).

or there better way?

create function todate(yy char(2), mm char(2), dd char(2)) returns date return date('20' || '-' || yy || '-' || mm || '-' || dd) 

select * table date <= todate(yy, mm, dd) 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -