<?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: Dynamic SQL in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839618#M939092</link>
    <description>Hi&lt;BR /&gt;it's a problem with '&lt;BR /&gt;&lt;BR /&gt;(select laststation from sn_master@sunsfr where sn= ''||xsn||'' and shiped=''N'') where sn= ''||xsn||'' and shiped=''N'' ';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you hae to quote ' with another ' &lt;BR /&gt;&lt;BR /&gt;Chris</description>
    <pubDate>Wed, 06 Nov 2002 07:05:12 GMT</pubDate>
    <dc:creator>Christian Gebhardt</dc:creator>
    <dc:date>2002-11-06T07:05:12Z</dc:date>
    <item>
      <title>Dynamic SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839615#M939089</link>
      <description>dynamic SQL strings&lt;BR /&gt;&lt;BR /&gt;Hi, &lt;BR /&gt;&lt;BR /&gt;I am newbie for PL/SQL . &lt;BR /&gt;I create a small program &lt;BR /&gt;------------- &lt;BR /&gt;CREATE OR REPLACE procedure snm_update as &lt;BR /&gt;xsn varchar2(25) :='0003BA16AED4'; &lt;BR /&gt;asn varchar2(25); &lt;BR /&gt;last varchar2(25); &lt;BR /&gt;time varchar2(25); &lt;BR /&gt;curr varchar2(25); &lt;BR /&gt;dml_str VARCHAR2(500); &lt;BR /&gt;CURSOR c1 IS &lt;BR /&gt;SELECT sn FROM tmp_sn; &lt;BR /&gt;BEGIN &lt;BR /&gt;open c1; &lt;BR /&gt;loop &lt;BR /&gt;fetch c1 into xsn; &lt;BR /&gt;exit when c1%NOTFOUND; &lt;BR /&gt;DBMS_OUTPUT.PUT_LINE(xsn); &lt;BR /&gt;dml_str := 'update sn_master &lt;BR /&gt;set laststation= &lt;BR /&gt;(select laststation from sn_master@sunsfr where sn= '||xsn||' and shiped='N') &lt;BR /&gt;where sn= '||xsn||' and shiped='N' '; &lt;BR /&gt;DBMS_OUTPUT.PUT_LINE(dml_str); &lt;BR /&gt;-- execute immediate dml_str; &lt;BR /&gt;commit; &lt;BR /&gt;END LOOP; &lt;BR /&gt;close c1; &lt;BR /&gt;END; &lt;BR /&gt;/ &lt;BR /&gt;----------------------------- &lt;BR /&gt;when complie it got error &lt;BR /&gt;SQL&amp;gt; show errors &lt;BR /&gt;Errors for PROCEDURE SNM_UPDATE: &lt;BR /&gt;&lt;BR /&gt;LINE/COL ERROR &lt;BR /&gt;-------- ----------------------------------------------------------------- &lt;BR /&gt;18/75 PLS-00103: Encountered the symbol ") &lt;BR /&gt;where sn= " when expecting one of the following: &lt;BR /&gt;. ( * @ % &amp;amp; = - + ; &amp;lt; / &amp;gt; at in mod not rem &lt;BR /&gt;&lt;AN exponent=""&gt; &amp;lt;&amp;gt; or != or ~= &amp;gt;= &amp;lt;= &amp;lt;&amp;gt; and or like &lt;BR /&gt;between is null is not || is dangling &lt;BR /&gt;The symbol "(" was substituted for ") &lt;BR /&gt;where sn= " to continue. &lt;BR /&gt;&lt;BR /&gt;19/33 PLS-00103: Encountered the symbol " " when expecting one of the &lt;BR /&gt;following: &lt;BR /&gt;. ( ) , * @ % &amp;amp; | = - + &amp;lt; / &amp;gt; at in mod not rem =&amp;gt; .. &lt;BR /&gt;&lt;BR /&gt;LINE/COL ERROR &lt;BR /&gt;-------- ----------------------------------------------------------------- &lt;BR /&gt;&lt;AN exponent=""&gt; &amp;lt;&amp;gt; or != or ~= &amp;gt;= &amp;lt;= &amp;lt;&amp;gt; and or like as &lt;BR /&gt;between from using is null is not || is dangling &lt;BR /&gt;The symbol ") was inserted before " " to continue. &lt;BR /&gt;----------------------------------------------- &lt;BR /&gt;&lt;BR /&gt;How can my program can execute SQL like &lt;BR /&gt;update sn_master &lt;BR /&gt;set laststation= &lt;BR /&gt;(select laststation from sn_master@sunsfr &lt;BR /&gt;where sn='0003BA16AED4' and shiped='N') &lt;BR /&gt;where sn='0003BA16AED4' and shiped='N' &lt;BR /&gt;------------------------ &lt;BR /&gt;I want to substitute 0003BA16AED4 with variable xsn &lt;BR /&gt;please suggest , thanks in advance. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/AN&gt;&lt;/AN&gt;</description>
      <pubDate>Wed, 06 Nov 2002 04:42:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839615#M939089</guid>
      <dc:creator>Printaporn_1</dc:creator>
      <dc:date>2002-11-06T04:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839616#M939090</link>
      <description>Hi there.&lt;BR /&gt;Is this line as you wrote it ?&lt;BR /&gt;&lt;BR /&gt;dml_str := 'update sn_master &lt;BR /&gt;&lt;BR /&gt;If yes change it to &lt;BR /&gt;&lt;BR /&gt;dml_str := 'update sn_master';&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;Alexander M. Ermes&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Nov 2002 06:35:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839616#M939090</guid>
      <dc:creator>Alexander M. Ermes</dc:creator>
      <dc:date>2002-11-06T06:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839617#M939091</link>
      <description>Hi there.&lt;BR /&gt;Is this line as you wrote it ?&lt;BR /&gt;&lt;BR /&gt;dml_str := 'update sn_master &lt;BR /&gt;&lt;BR /&gt;If yes change it to &lt;BR /&gt;&lt;BR /&gt;dml_str := 'update sn_master';&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;Alexander M. Ermes&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Nov 2002 06:36:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839617#M939091</guid>
      <dc:creator>Alexander M. Ermes</dc:creator>
      <dc:date>2002-11-06T06:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839618#M939092</link>
      <description>Hi&lt;BR /&gt;it's a problem with '&lt;BR /&gt;&lt;BR /&gt;(select laststation from sn_master@sunsfr where sn= ''||xsn||'' and shiped=''N'') where sn= ''||xsn||'' and shiped=''N'' ';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you hae to quote ' with another ' &lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 06 Nov 2002 07:05:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839618#M939092</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-11-06T07:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839619#M939093</link>
      <description>Hi &lt;BR /&gt;Attention:&lt;BR /&gt;In my former posting the ''N'' are two single qoutes not a double quote. The output from my browser doesn't show this.&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 06 Nov 2002 07:08:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839619#M939093</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-11-06T07:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839620#M939094</link>
      <description>thanks Christian, you give me the guide but the right one is&lt;BR /&gt;-------------------&lt;BR /&gt;CREATE OR REPLACE procedure snm_update as&lt;BR /&gt;xsn varchar2(25) :='0003BA16AED4';&lt;BR /&gt;asn varchar2(25);&lt;BR /&gt;last varchar2(25);&lt;BR /&gt;time varchar2(25);&lt;BR /&gt;curr varchar2(25);&lt;BR /&gt;dml_str VARCHAR2(500);&lt;BR /&gt;CURSOR c1 IS&lt;BR /&gt;SELECT sn FROM tmp_sn;&lt;BR /&gt;BEGIN&lt;BR /&gt;open c1;&lt;BR /&gt;loop&lt;BR /&gt;fetch  c1 into xsn;&lt;BR /&gt;exit when c1%NOTFOUND;&lt;BR /&gt;DBMS_OUTPUT.PUT_LINE(xsn);&lt;BR /&gt;dml_str := 'update sn_master set laststation=(select laststation from sn_master@sunsfr where sn= '''||xsn||''' and shiped=''N'')  where sn= '''||xsn||''' and shiped=''N'' ';&lt;BR /&gt;DBMS_OUTPUT.PUT_LINE(dml_str);&lt;BR /&gt;-- execute immediate dml_str;&lt;BR /&gt;commit;&lt;BR /&gt;END LOOP;&lt;BR /&gt;close c1;&lt;BR /&gt;END;&lt;BR /&gt;/&lt;BR /&gt;--------------------&lt;BR /&gt;and the result:&lt;BR /&gt;SQL&amp;gt; execute snm_update&lt;BR /&gt;0003BA16AED4&lt;BR /&gt;update sn_master set laststation=(select laststation from sn_master@sunsfr where&lt;BR /&gt;sn= '0003BA16AED4' and shiped='N')  where sn= '0003BA16AED4' and shiped='N'&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.</description>
      <pubDate>Wed, 06 Nov 2002 08:35:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-sql/m-p/2839620#M939094</guid>
      <dc:creator>Printaporn_1</dc:creator>
      <dc:date>2002-11-06T08:35:18Z</dc:date>
    </item>
  </channel>
</rss>

