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

11,303

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.

Share:
11,303
BasicCoder
Author by

BasicCoder

Updated on June 11, 2022

Comments

  • BasicCoder
    BasicCoder almost 2 years

    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.