Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define/declare and use variable in Squirrel SQL client 3

I use the software SQuirreL SQL Client Version 3.2.1 and I want to declare variable like

define dateFrom = '13/04/2012';
define dateTo = '13/04/2012'

And to use it in my sql query like that

SELECT * FROM table_name WHERE TRUNC(column_name) BETWEEN to_date('&dateFrom','YYYY-MM-DD') AND to_date('&dateTo','YYYY-MM-DD');

But it doesn't work. How can I define and use variable in SQuirreL.

like image 998
BasicCoder Avatar asked Nov 25 '22 23:11

BasicCoder


1 Answers

Maybe not quite what you want, but have you tried loading plugin 'sqlparam'? It offers variable substition, e.g.

SELECT * FROM table_name WHERE TRUNC(column_name) BETWEEN :dateFrom and :dataTo

When running this query Squirrel will ask for values.

like image 192
Tom Verweij Avatar answered May 16 '23 08:05

Tom Verweij