I did forget to mention we are constrained to IB 7 at the moment, but I will try the above :-)<br><br>Jeremy<br><br><div class="gmail_quote">On Wed, Sep 22, 2010 at 10:36 AM, Willie Juson <span dir="ltr"><<a href="mailto:willie.juson@satara.co.nz">willie.juson@satara.co.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-NZ">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Hi,</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">From the Interbase (2007) Language reference manual ......</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 11pt;">“The stored procedure and trigger
language does not include many of the statement types</span></p>
<p class="MsoNormal" style=""><span style="font-size: 11pt;">available in DSQL or <b>gpre</b>. The
following statement types are not supported in triggers or</span></p>
<p class="MsoNormal" style=""><span style="font-size: 11pt;">stored procedures:</span></p>
<p class="MsoNormal" style=""><span style="font-size: 11pt;">• Data definition language
statements: CREATE, ALTER, DROP, DECLARE EXTERNAL...” etc etc</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">So I’d say you can’t do it from within a Stored
procedure. You might have to do it via DSQL from your code.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Firebird would let you do something along the lines of....</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">DECLARE VARIABLE SQLSTR VARCHAR(2000);</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">BEGIN</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> SQLStr = 'Create Table DAR_RESULTS (PATIENTID char(7),
TEST_NAME varchar(30), WHENRECEIVED date, RESULT varchar(16));';</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> EXECUTE STATEMENT SQLStr;</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">END</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">But I take it you’re not using Firebird.....</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt;" lang="EN-US">From:</span></b><span style="font-size: 10pt;" lang="EN-US"> <a href="mailto:delphi-bounces@delphi.org.nz" target="_blank">delphi-bounces@delphi.org.nz</a>
[mailto:<a href="mailto:delphi-bounces@delphi.org.nz" target="_blank">delphi-bounces@delphi.org.nz</a>] <b>On Behalf Of </b>Jeremy Coulter<br>
<b>Sent:</b> Wednesday, 22 September 2010 9:32 a.m.<br>
<b>To:</b> NZ Borland Developers Group - Delphi List<br>
<b>Subject:</b> [DUG] Interbase Stored Proc</span></p>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </p>
<p class="MsoNormal">Hi all.<br>
I know a few of you out there work with Interbase so I thought I might ask the
following question here.<br>
<br>
I want to create a stored procedure that creates a table. So I am doing :-<br>
<br>
<br>
CREATE PROCEDURE MySP_ AS <br>
begin<br>
create table DAR_RESULTS<br>
(<br>
PATIENTID char(7),<br>
TEST_NAME varchar(30),<br>
WHENRECEIVED date,<br>
RESULT varchar(16)<br>
);<br>
END<br>
<br>
<br>
However, it doesnt like this and complains avout the "("
althought when I removed this it still gave the same error :-)<br>
<br>
can someone who knows IB a bit better point me in the right direction?<br>
<br>
<br>
Jeremy</p>
</div></div></div>
</div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br></blockquote></div><br>