<?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: PL/SQL  error when parsing shell variables in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834346#M938643</link>
    <description>Thank you for your hints Christian !&lt;BR /&gt;&lt;BR /&gt;Thierry</description>
    <pubDate>Tue, 29 Oct 2002 15:08:51 GMT</pubDate>
    <dc:creator>Thierry Lethuillier</dc:creator>
    <dc:date>2002-10-29T15:08:51Z</dc:date>
    <item>
      <title>PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834338#M938635</link>
      <description>Does somebody know how to use Shell variables in a PL/SQL embeded script ?&lt;BR /&gt;&lt;BR /&gt;This is my simplified code;&lt;BR /&gt;&lt;BR /&gt;# /usr/bin/ksh&lt;BR /&gt;MY_TABLE="ING"&lt;BR /&gt;SITE_NUM=99&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s dummy/dummy &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;DECLARE&lt;BR /&gt;Tablesp  all_all_tables.tablespace_name%TYPE;&lt;BR /&gt;BEGIN&lt;BR /&gt;&lt;BR /&gt;SELECT unique tablespace_name INTO Tablesp FROM all_all_tables&lt;BR /&gt;WHERE table_name=${MY_TABLE}${SITE_NUM} ;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;RENAME ${MY_TABLE}${SITE_NUM} TO tmp_${MY_TABLE}${SITE_NUM} ;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;END;&lt;BR /&gt;/&lt;BR /&gt;EXIT&lt;BR /&gt;EOF&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;The PL/SQL parser fails parsing the RENAME instruction;&lt;BR /&gt;&lt;BR /&gt;RENAME ING99 TO tmp_ING99 ;&lt;BR /&gt;       *&lt;BR /&gt;ERROR line 8:&lt;BR /&gt;ORA-06550: Line 8, column 8:&lt;BR /&gt;PLS-00103: Found "ING99" but expected one of the following: := . ( @ % ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;Thier</description>
      <pubDate>Mon, 28 Oct 2002 15:07:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834338#M938635</guid>
      <dc:creator>Thierry Lethuillier</dc:creator>
      <dc:date>2002-10-28T15:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834339#M938636</link>
      <description>Your best option is to use echo to build the command 'on the fly' and output to a temp file. You then use the temp file as input to sqlplus. &lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;TDIR=${TMPDIR:-/var/tmp}&lt;BR /&gt;S1=${TDIR}/X${$}_1.sql&lt;BR /&gt;&lt;BR /&gt;echo "select unique tablespace_name into Tablesp FROM " &amp;gt; ${S1}&lt;BR /&gt;echo "all_all_tables WHERE table_name=${MY_TABLE}${SITE_NUM}"&lt;BR /&gt;&lt;BR /&gt;.....&lt;BR /&gt;&lt;BR /&gt;You need to do a rm -f ${S1} when finished to remove the temp file. If you need to echo special characters like $ then you will need to escape them with backslashes.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Oct 2002 15:32:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834339#M938636</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-28T15:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834340#M938637</link>
      <description>Your best option is to use echo to build the command 'on the fly' and output to a temp file. You then use the temp file as input to sqlplus. &lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;TDIR=${TMPDIR:-/var/tmp}&lt;BR /&gt;S1=${TDIR}/X${$}_1.sql&lt;BR /&gt;&lt;BR /&gt;echo "select unique tablespace_name into Tablesp FROM " &amp;gt; ${S1}&lt;BR /&gt;echo "all_all_tables WHERE table_name=${MY_TABLE}${SITE_NUM};" &amp;gt;&amp;gt; ${S1}&lt;BR /&gt;&lt;BR /&gt;.....&lt;BR /&gt;&lt;BR /&gt;You need to do a rm -f ${S1} when finished to remove the temp file. If you need to echo special characters like $ then you will need to escape them with backslashes.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Oct 2002 15:32:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834340#M938637</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-28T15:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834341#M938638</link>
      <description>You will need to parse the SQL statment on the fly as you go.  In Oracle 8i, you can do this with the following:&lt;BR /&gt;----------------&lt;BR /&gt;In your declaration area:&lt;BR /&gt;sqlstatement varchar2(400);&lt;BR /&gt;&lt;BR /&gt;In your code:&lt;BR /&gt;sqlstatement:='rename ${MY_TABLE}${SITE_NUM} TO tmp_${MY_TABLE}${SITE_NUM}'; &lt;BR /&gt;execute immediate sqlstatement;&lt;BR /&gt;----------------&lt;BR /&gt;&lt;BR /&gt;You might want to consider either creating a procedure for this, or passing the variables in at the command line and using a script, rather than the passing the script and variables through stdin.  &lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Mon, 28 Oct 2002 23:44:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834341#M938638</guid>
      <dc:creator>Brian Crabtree</dc:creator>
      <dc:date>2002-10-28T23:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834342#M938639</link>
      <description>Unfortunately I use Oracle 8.0.5.&lt;BR /&gt;&lt;BR /&gt;Is there another way to use Shell variables under PL/SQL ?</description>
      <pubDate>Tue, 29 Oct 2002 13:22:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834342#M938639</guid>
      <dc:creator>Thierry Lethuillier</dc:creator>
      <dc:date>2002-10-29T13:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834343#M938640</link>
      <description>Hi Thierry&lt;BR /&gt;&lt;BR /&gt;It is not a problem with parsing shell-variables, there are some errors in your script:&lt;BR /&gt;&lt;BR /&gt;- First: in the select-statement you have to youse single quotations for the where-clause&lt;BR /&gt;- Second: In PL/SQL you cannot use DDL-Commands directly, "Rename ..." is a DDL Command.&lt;BR /&gt;You can use a PL-SQL Package named DBMS_SQL&lt;BR /&gt;&lt;BR /&gt;This script works:&lt;BR /&gt;&lt;BR /&gt;# /usr/bin/ksh&lt;BR /&gt;MY_TABLE="ING"&lt;BR /&gt;SITE_NUM=99&lt;BR /&gt; &lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s dummy/dummy@c &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;DECLARE&lt;BR /&gt; &lt;BR /&gt;stmnt VARCHAR2(2000);&lt;BR /&gt;cur INTEGER;&lt;BR /&gt;ret INTEGER;&lt;BR /&gt;Tablesp all_all_tables.tablespace_name%TYPE;&lt;BR /&gt; &lt;BR /&gt;BEGIN&lt;BR /&gt; &lt;BR /&gt;SELECT unique tablespace_name INTO Tablesp FROM all_all_tables&lt;BR /&gt;WHERE table_name='${MY_TABLE}${SITE_NUM}' ;&lt;BR /&gt; &lt;BR /&gt;stmnt:='RENAME ${MY_TABLE}${SITE_NUM} TO tmp_${MY_TABLE}${SITE_NUM}' ;&lt;BR /&gt;cur := DBMS_SQL.OPEN_CURSOR;&lt;BR /&gt;DBMS_SQL.PARSE(cur, stmnt, dbms_sql.v7);&lt;BR /&gt;ret := DBMS_SQL.EXECUTE(cur);&lt;BR /&gt;DBMS_SQL.CLOSE_CURSOR(cur);&lt;BR /&gt; &lt;BR /&gt;END;&lt;BR /&gt;/&lt;BR /&gt;EXIT&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Tue, 29 Oct 2002 13:50:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834343#M938640</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-10-29T13:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834344#M938641</link>
      <description>Another hint:&lt;BR /&gt;When using &lt;BR /&gt;sqlplus dummy/dummy &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;STATEMENT&gt;&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;everyone can see your password with command "ps -efa"&lt;BR /&gt;&lt;BR /&gt;Better way: &lt;BR /&gt;sqlplus &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;dummy/dummy&lt;BR /&gt;&lt;STATEMENT&gt;&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;Chris&lt;/STATEMENT&gt;&lt;/STATEMENT&gt;</description>
      <pubDate>Tue, 29 Oct 2002 13:53:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834344#M938641</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-10-29T13:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834345#M938642</link>
      <description>Hi&lt;BR /&gt;Excuse me, you have to delete "@c" in the message above, it's my private database.&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Tue, 29 Oct 2002 13:56:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834345#M938642</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-10-29T13:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: PL/SQL  error when parsing shell variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834346#M938643</link>
      <description>Thank you for your hints Christian !&lt;BR /&gt;&lt;BR /&gt;Thierry</description>
      <pubDate>Tue, 29 Oct 2002 15:08:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pl-sql-error-when-parsing-shell-variables/m-p/2834346#M938643</guid>
      <dc:creator>Thierry Lethuillier</dc:creator>
      <dc:date>2002-10-29T15:08:51Z</dc:date>
    </item>
  </channel>
</rss>

