in reply to Ignoring "$" sign in sql-statement to Oracle

Your issue is that the qq delimiter interpolates variables (see Quote and Quote like Operators). You can either swap to an operator that does not interpolate, such as q, or you can escape the $ with a backslash, like

my $sql = qq { select SID,SERIAL,USERNAME,STATUS,SCHEMANAME,OSUSER, PROCESS,MACHINE,TERMINAL,PROGRAM,TYPE,MODULE, to_char(LOGON_TIME,'DD-MON-YY HH24:MI:SS')"LOGON_TIME", STATE,SERVICE_NAME from v\$session order by LOGON_TIME DESC};
If I were writing this, I would likely use a here-doc:

my $sql = <<'EOSQL'; select SID,SERIAL,USERNAME,STATUS,SCHEMANAME,OSUSER, PROCESS,MACHINE,TERMINAL,PROGRAM,TYPE,MODULE, to_char(LOGON_TIME,'DD-MON-YY HH24:MI:SS')"LOGON_TIME", STATE,SERVICE_NAME from v$session order by LOGON_TIME DESC} EOSQL

Note that the ' in the here-doc suppresses interpolation.

Replies are listed 'Best First'.
Re^2: Ignoring "$" sign in sql-statement to Oracle
by gizmojunkee (Novice) on Mar 29, 2011 at 15:43 UTC
    Awesome, thanks for your swift help guys that totally made sense.