<?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 'Drop / Create Table' inside a stored procedure in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623938#M18224</link>
    <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Does anyone know if it is possible to put CREATE/DROP statements into a stored procedure for Oracle RDB (OpenVMS 8.3, Oracle RDB 7.3)?&lt;BR /&gt;&lt;BR /&gt;Example of sql script:&lt;BR /&gt;CREATE MODULE DB_UPGR&lt;BR /&gt;LANGUAGE SQL&lt;BR /&gt; PROCEDURE PROC();&lt;BR /&gt; BEGIN&lt;BR /&gt;  DROP TABLE UPGR_VERSIONS IF EXISTS;&lt;BR /&gt; END;&lt;BR /&gt;END MODULE;&lt;BR /&gt;COMMIT;&lt;BR /&gt;ROLLBACK;&lt;BR /&gt;&lt;BR /&gt;Where 'DROP' expression fails in this way:&lt;BR /&gt;&lt;BR /&gt;cont&amp;gt;           DROP TABLE UPGR_VERSIONS IF EXISTS;&lt;BR /&gt;%SQL-I-DEPR_FEATURE, Deprecated Feature: Keyword DROP used as an identifier&lt;BR /&gt;                DROP TABLE UPGR_VERSIONS IF EXISTS;&lt;BR /&gt;                     ^&lt;BR /&gt;%SQL-F-LOOK_FOR, Syntax error, looking for :, found TABLE instead&lt;BR /&gt;&lt;BR /&gt;I have seen couple of articles where it was said that data definition statements like CREATE/DROP/ALTER are not allowed inside the procedure. The others said that EXECUTE 'statement' could help in this case but I'm afraid it doesn't work for Oracle RDB, does it?&lt;BR /&gt;</description>
    <pubDate>Mon, 26 Apr 2010 12:50:05 GMT</pubDate>
    <dc:creator>Dmitry V. Sinelnikov</dc:creator>
    <dc:date>2010-04-26T12:50:05Z</dc:date>
    <item>
      <title>'Drop / Create Table' inside a stored procedure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623938#M18224</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Does anyone know if it is possible to put CREATE/DROP statements into a stored procedure for Oracle RDB (OpenVMS 8.3, Oracle RDB 7.3)?&lt;BR /&gt;&lt;BR /&gt;Example of sql script:&lt;BR /&gt;CREATE MODULE DB_UPGR&lt;BR /&gt;LANGUAGE SQL&lt;BR /&gt; PROCEDURE PROC();&lt;BR /&gt; BEGIN&lt;BR /&gt;  DROP TABLE UPGR_VERSIONS IF EXISTS;&lt;BR /&gt; END;&lt;BR /&gt;END MODULE;&lt;BR /&gt;COMMIT;&lt;BR /&gt;ROLLBACK;&lt;BR /&gt;&lt;BR /&gt;Where 'DROP' expression fails in this way:&lt;BR /&gt;&lt;BR /&gt;cont&amp;gt;           DROP TABLE UPGR_VERSIONS IF EXISTS;&lt;BR /&gt;%SQL-I-DEPR_FEATURE, Deprecated Feature: Keyword DROP used as an identifier&lt;BR /&gt;                DROP TABLE UPGR_VERSIONS IF EXISTS;&lt;BR /&gt;                     ^&lt;BR /&gt;%SQL-F-LOOK_FOR, Syntax error, looking for :, found TABLE instead&lt;BR /&gt;&lt;BR /&gt;I have seen couple of articles where it was said that data definition statements like CREATE/DROP/ALTER are not allowed inside the procedure. The others said that EXECUTE 'statement' could help in this case but I'm afraid it doesn't work for Oracle RDB, does it?&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2010 12:50:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623938#M18224</guid>
      <dc:creator>Dmitry V. Sinelnikov</dc:creator>
      <dc:date>2010-04-26T12:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: 'Drop / Create Table' inside a stored procedure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623939#M18225</link>
      <description>Dmitry,&lt;BR /&gt;&lt;BR /&gt;I suggest you issue under SQL an&lt;BR /&gt;HELP COMPOUND_STMT:&lt;BR /&gt;Can include only a subset of the SQL statements allowed in a simple statement procedure. (See the compound-use-statement syntax diagram for a list of these valid statements.)&lt;BR /&gt;&lt;BR /&gt;Then Format&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;JFP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2010 13:50:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623939#M18225</guid>
      <dc:creator>Jean-François Piéronne</dc:creator>
      <dc:date>2010-04-26T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: 'Drop / Create Table' inside a stored procedure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623940#M18226</link>
      <description>&lt;BR /&gt;in addition to this theme: is there any way to get rid of error messages like this&lt;BR /&gt;&lt;BR /&gt;%SQL-F-REL_EXISTS, Table X already exists in this database or schema&lt;BR /&gt;%SQL-F-CONALREXI, Constraint name Y already exists in this database or schema&lt;BR /&gt;%SQL-F-COLEXISTS, Column Z is named more than once in table NR_CREDITS&lt;BR /&gt;&lt;BR /&gt;when executing a script on the same DB more than once?&lt;BR /&gt;Of course we can redirect output to the file and delete this messages to see the 'clear' log... Just wanted to know if this can be done somehow using RDB tools.&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2010 07:19:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623940#M18226</guid>
      <dc:creator>Dmitry V. Sinelnikov</dc:creator>
      <dc:date>2010-06-16T07:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: 'Drop / Create Table' inside a stored procedure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623941#M18227</link>
      <description>Hi Dimitry,&lt;BR /&gt;&lt;BR /&gt;What happened to your DROP TABLE x IF EXISTS; commands immediately prior to you CREATE TABLE commands? Unlike Orrible Oracle Rdb does not have CREATE OR REPLACE syntax but I guess you can always interrogate the Metadata tables if need be, but not completely sure of the requirement here?&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher</description>
      <pubDate>Wed, 16 Jun 2010 13:05:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623941#M18227</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2010-06-16T13:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: 'Drop / Create Table' inside a stored procedure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623942#M18228</link>
      <description>Hi Richard,&lt;BR /&gt;&lt;BR /&gt;DROP ... IF EXISTS is useful of course but we have a customer that needs to upgrade his database iteratively and he doesn't want to lose the previous data. So if we include DROP before the CREATE then every upgrade will erase all the data accumulated after the previous upgrade. That's not acceptable.&lt;BR /&gt;&lt;BR /&gt;Of course we can add some check like this:&lt;BR /&gt;IF ( EXISTS( SELECT * FROM RDB$RELATIONS WHERE RDB$RELATION_NAME = 'TABLE_NAME' LIMIT TO 1 ROWS ) )&lt;BR /&gt;but this can be done only in scope of BEGIN-END expression which doesn't allow CREATE/DROP/ALTER commands as already mentioned above.&lt;BR /&gt;&lt;BR /&gt;WBR, Dmitry&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jun 2010 20:08:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/drop-create-table-inside-a-stored-procedure/m-p/4623942#M18228</guid>
      <dc:creator>Dmitry V. Sinelnikov</dc:creator>
      <dc:date>2010-06-16T20:08:42Z</dc:date>
    </item>
  </channel>
</rss>

