<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help with a Perl expression... in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914138#M65222</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Perhaps:&lt;BR /&gt;&lt;BR /&gt;my $query0 = 'select /* q-field-query */ count(*) from ' . "$schema" . '.FIELD_Q&lt;BR /&gt;UEUE where Q_NAME=' . "'" . $queuename . "'" . ';';&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Sat, 16 Dec 2006 15:30:03 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-12-16T15:30:03Z</dc:date>
    <item>
      <title>Help with a Perl expression...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914137#M65221</link>
      <description>I would like to know if someone can help me with the following; I am trying to get a query running from within a perl script, it reads as follows:&lt;BR /&gt;&lt;BR /&gt;my $schema = 'test_schema';&lt;BR /&gt;my $queuename = 'Q$_FIELD_QUEUE';&lt;BR /&gt;&lt;BR /&gt;my $query0 = 'select /* q-field-query */ count(*) from ' . "$schema" . '.FIELD_QUEUE where Q_NAME=' . "'" . '"' . "'$queuename'" . '"' . "'" . ';';&lt;BR /&gt;&lt;BR /&gt;The query I obtain when I run the above is:&lt;BR /&gt;&lt;BR /&gt;select /* q-field-query */ count(*) from test_schema.FIELD_QUEUE where Q_NAME='"'Q$_FIELD_QUEUE'"';"&lt;BR /&gt;&lt;BR /&gt;However, the results are not correct as they do not match what I get when I run the query in a sqlplus session.  That embedded '$' in the field that is being searched has become quite problematic, the SQL I'd like to run should be:&lt;BR /&gt;&lt;BR /&gt;select /* q-field-query */ count(*) from test_schema.FIELD_QUEUE where Q_NAME='Q$_FIELD_QUEUE';&lt;BR /&gt;&lt;BR /&gt;Any advise on how exactly I can get that result?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;MAD</description>
      <pubDate>Sat, 16 Dec 2006 13:12:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914137#M65221</guid>
      <dc:creator>MAD_2</dc:creator>
      <dc:date>2006-12-16T13:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Perl expression...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914138#M65222</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Perhaps:&lt;BR /&gt;&lt;BR /&gt;my $query0 = 'select /* q-field-query */ count(*) from ' . "$schema" . '.FIELD_Q&lt;BR /&gt;UEUE where Q_NAME=' . "'" . $queuename . "'" . ';';&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 16 Dec 2006 15:30:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914138#M65222</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-16T15:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Perl expression...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914139#M65223</link>
      <description>Thank you for your reply James... I ommitted a very crucial part of information in my previous thread I'd like to include now.&lt;BR /&gt;&lt;BR /&gt;This part of code is actually being used to build a full statement that is used to ssh into another system to run the SQL there.&lt;BR /&gt;&lt;BR /&gt;The problem I have discovered now is that when feeding the code, the $ is truncated from the rest of the SQL code when running the statement.  The ssh should be running this chunk of code (don't worry about the $ORACLE_SERVICE below, it's defined elsewhere in the code and since it's a variable obtained from the environment it's passed correctly):&lt;BR /&gt;&lt;BR /&gt;ssh account@system '. /envpath/env; ORACLEPASS=`/usr/local/bin/sudo -u accountowner -H grep "^$ORACLE_USER" /passpath/.pwd | cut -f 2`; echo "alter session set current_schema = test_schema;&lt;BR /&gt;select /* q-field-query */ count(*) from test_schema.FIELD_QUEUE where Q_NAME='Q$_FIELD_QUEUE';" | /oracle/admin/bin/sqlplus -S ${ORACLE_USER}/${ORACLEPASS}@${ORACLE_SERVICE};'&lt;BR /&gt;&lt;BR /&gt;The problem is occurring on the 'literal' "$" in the "Q$FIELD_QUEUE".  How can I make it so that when this portion is passed to the ssh, it's taken as a literal in that context?&lt;BR /&gt;&lt;BR /&gt;The way it's actually reading the SQL statement is now truncated to read  only:&lt;BR /&gt;&lt;BR /&gt;alter session set current_schema = test_schema;&lt;BR /&gt;select /* q-field-query */ count(*) from test_schema.FIELD_QUEUE where Q_NAME='Q';&lt;BR /&gt;&lt;BR /&gt;And of course, that defined field does not exist so the query returns a false result.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;MAD&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 16 Dec 2006 16:07:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914139#M65223</guid>
      <dc:creator>MAD_2</dc:creator>
      <dc:date>2006-12-16T16:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Perl expression...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914140#M65224</link>
      <description>The issue is that you're echo'n a double-quoted string, which allows the interpretation of the variables within it.&lt;BR /&gt;&lt;BR /&gt;You need to echo the the query as a single-quoted echo, i.e.:&lt;BR /&gt;&lt;BR /&gt;echo 'alter session set current_schema = test_schema; select .....&lt;BR /&gt;&lt;BR /&gt;So you'll need to change the thing that generates that select to use "'s, or escaped ''s.&lt;BR /&gt;&lt;BR /&gt;This should stop the 'echo' form interpreting the $'d Q_NAME in the shell.</description>
      <pubDate>Sat, 16 Dec 2006 18:59:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914140#M65224</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2006-12-16T18:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a Perl expression...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914141#M65225</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Instead of writing:&lt;BR /&gt;&lt;BR /&gt;Q_NAME='Q$_FIELD_QUEUE'&lt;BR /&gt;&lt;BR /&gt;do:&lt;BR /&gt;&lt;BR /&gt;Q_NAME='Q\$_FIELD_QUEUE'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 18 Dec 2006 09:21:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-with-a-perl-expression/m-p/3914141#M65225</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-18T09:21:04Z</dc:date>
    </item>
  </channel>
</rss>

