[英]Extract values from IN parameter and store it in local variables in postgreSQL
I have :listDate:String
IN parameter that I'm passing to my proc which contains the dynamic values separated by , 我将:listDate:String
IN参数传递给了proc,其中包含由,
This :listDate:String
is passed to proc from Java front end and it contains the value selected by the user :listDate:String
从Java前端传递到proc,它包含用户选择的值
There can be many combinations 可以有很多组合
Case 1 listDate
can have 情况1 listDate
可以有
1. 30 Dec 2013 to 05 Jan 2014 1. 2013年12月30日至2014年1月5日
so v_start_date
is 30 Dec 2013 and 因此v_start_date
是2013年12月30日 ,
v_end_date
is 05 Jan 2014 v_end_date
是2014年1月5日
Case 2 listdate
can have 案例2 listdate
可以有
30 Dec 2013 to 05 Jan 2014, 2013年12月30日至2014年1月5日,
06 Jan 2014 to 12 Jan 2014 2014年1月6日至2014年1月12日
so v_start_date
is 30 Dec 2013 and 因此v_start_date
是2013年12月30日 ,
v_end_date
is 12 Jan 2014 v_end_date
是2014年1月12日
Case 3 listDate
can have 情况3 listDate
可以有
06 Jan 2014 to 12 Jan 2014, 2014年1月6日至2014年1月12日,
13 Jan 2014 to 19 Jan 2014, 2014年1月13日至2014年1月19日,
20 Jan 2014 to 26 Jan 2014 2014年1月20日至2014年1月26日
so v_start_date
is 06 Jan 2014 and v_end_date
is 26 Jan 2014 因此v_start_date
为2014 年1月 6日 , v_end_date
为2014年1月26日
How can I extract the values as shown above into v_start_date
and v_end_date
? 如何将上面显示的值提取到v_start_date
和v_end_date
?
I was able to resolve it by using 我能够通过使用解决它
select substring(listDate from '............$') as v_end_date,
substring(listDate from '^...............') as v_start_date
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.