🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #666

Creating Strored Procedure at Runtime

#666
From: Peter Batten
Date: Fri, 26 Oct 2007 05:16
99 lines
4692 bytes
Hi,

I can create many IB tables, triggers, generators, indexes, procedures etc
with run time sql calls but when I try to build the following stored
procedure I get an error :-

Field 'AddressAutoNo' is of an unknown type.

This is originating from the first variable after the 'values' statement
ie  :AddressAutoNo

If I cut the Value of quUpdateStructure.Sql ie quUpdateStructure.Sql[0] and
paste it into IBConsole it integrates just fine

Any help greatly appreciated

Regards

Peter



quUpdateStructure.SQL.Clear;
quUpdateStructure.Sql.Add(
                                    '  CREATE PROCEDURE INSERT_Address(
AddressAutoNo INTEGER, Description VARCHAR(50), UpperDescription
VARCHAR(50),                            ' +
                                    '
RoomLevel VARCHAR(50), UpperRoomLevel VARCHAR(50), Building VARCHAR(50),
' +
                                    '
UpperBuilding VARCHAR(50), POBox VARCHAR(50), UpperPOBox VARCHAR(50),
' +
                                    '
Street VARCHAR(50), UpperStreet VARCHAR(50), UpperStreetName VARCHAR(50),
Suburb VARCHAR(50),           ' +
                                    '
UpperSuburb VARCHAR(50), PostCode VARCHAR(15), PreSortCode VARCHAR(50),
StateRegion VARCHAR(50),        ' +
                                    '
UpperStateRegion VARCHAR(50), Country VARCHAR(50), AddressSource VARCHAR(1),
' +
                                    '
MainAddress VARCHAR(1), IsDead VARCHAR(1), IsInvoiceAddress VARCHAR(1),
IsShipAddress VARCHAR(1),       ' +
                                    '
PhysicalAddr VARCHAR(1), SoundexUStreet VARCHAR(50), CountryAutoNo INTEGER,
AddressQuality INTEGER)     ' +
                                    '  AS BEGIN
' +
                                    '      Insert into Address
' +
                                    '                 (AddressAutoNo,
Description, UpperDescription, RoomLevel, UpperRoomLevel,
' +
                                    '                  Building,
UpperBuilding, POBox, UpperPOBox, Street, UpperStreet, UpperStreetName,
Suburb, UpperSuburb,                   ' +
                                    '                  PostCode,
PreSortCode, StateRegion, UpperStateRegion, Country, AddressSource,
MainAddress, IsDead,                       ' +
                                    '                  IsInvoiceAddress,
IsShipAddress, PhysicalAddr, SoundexUStreet, LastChange, CountryAutoNo,
AddressQuality)                ' +
                                    '      values
' +
                                    '                (:AddressAutoNo,
:Description, :UpperDescription, :RoomLevel, :UpperRoomLevel,
' +
                                    '                 :Building,
:UpperBuilding, :POBox, :UpperPOBox, :Street, :UpperStreet,
:UpperStreetName, :Suburb, :UpperSuburb,           ' +
                                    '                 :PostCode,
:PreSortCode, :StateRegion, :UpperStateRegion, :Country, :AddressSource,
:MainAddress, :IsDead,                ' +
                                    '                 :IsInvoiceAddress,
:IsShipAddress, :PhysicalAddr, :SoundexUStreet, ''NOW'', :CountryAutoNo,
:AddressQuality);             ' +
                                    '  END

'
                                    );

quUpdateStructure.ExecSQL;


Other smaller procedures work

            quUpdateStructure.SQL.Clear;
            quUpdateStructure.Sql.Add(' CREATE PROCEDURE
GET_GENERATED_Account_Auto RETURNS (AVALUE INTEGER) ' +
                                      ' AS BEGIN
' +
                                      ' AVALUE = GEN_ID(AccountAutoNoGen,
1);                                ' +
                                      ' END
'
                                      );
            quUpdateStructure.ExecSQL;
Technical Details
Message-ID: <4721784e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,ee7bb8d1327e66d4,start
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Peter Batten" <datafast@tpgi.com.au>
From: "Peter Batten" <datafast@tpgi.com.au>
Newsgroups: borland.public.interbase.sql
Subject: Creating Strored Procedure at Runtime
Date: Fri, 26 Oct 2007 15:16:38 +1000
Lines: 102
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1914
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914
NNTP-Posting-Host: 60.241.144.218
Message-ID: <4721784e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1193375822 60.241.144.218 (25 Oct 2007 22:17:02 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail