您好我试图声明一个变量在Oracle sql select查询中使用如下:
DECLARE myDate DATE; BEGIN SELECT Source as "Source",DT as "Date",Status as "Status",COALESCE("Count",0) as "Count" FROM (Huge SubQuery that includes many WHERE date between x and y); END;
我需要使用myDate进行查询,所以每次运行查询时我都不必在10个位置更新它.基本上它只是声明一个可以在where日期使用的变量是在几个地方的子句之间.
试试这个:
variable var DATE exec :var := '15-OCT-13'
然后你选择使用:var in it