in reply to Escaping and quoting ?????
But the query would be more readable if you used "heredoc" syntax.
here is a sample I use:
In my case, I DO use interpolation, and the string does expand the reference to $proxy->{CID}.my $sql=<<"_SQL_"; SELECT cl_plugins.pid_number as pid, plugin_catalog.pid AS plugin_ +name, plugin_catalog.description AS name, plugin_catalog.version, bui +ld FROM cl_plugins, plugin_catalog WHERE cl_plugins.cid::text = '$proxy->{CID}' AND cl_plugins.pid_number = plugin_catalog.pid_number AND cl_plugins.version::text = plugin_catalog.version::text; _SQL_
Your query could be:
This allows for the potential introduction of perl variables, where you would NOT escape the $.my $sql=<<"__SQL__"; SELECT to_char(pp.SUBMITTIME, 'YYYY-MM-DD HH:MM:SS') SUBMITTIME, to_char(pp.QUEUETIME, 'YYYY-MM-DD HH:MM:SS') QUEUETIME, to_char(pp.PREPTIME, 'YYYY-MM-DD HH:MM:SS') PREPTIME, to_char(pp.STARTTIME, 'YYYY-MM-DD HH:MM:SS') STARTTIME, pp.SESSIONID, pp.PLANID from '\$hist_plan_prolog_1' pp where pp.SUBMITTIME between '2014-06-26 05:00' and '2014-06-26 08:00:0 +0' order by pp.SUBMITTIME __SQL__
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Escaping and quoting ?????
by AnomalousMonk (Archbishop) on Jul 03, 2014 at 01:07 UTC | |
|
Re^2: Escaping and quoting ?????
by pgduke65 (Acolyte) on Jul 03, 2014 at 02:42 UTC | |
by thomas895 (Deacon) on Jul 03, 2014 at 03:56 UTC | |
by poj (Abbot) on Jul 03, 2014 at 09:22 UTC |