Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
AV with CREATE PROCEDURE |
Fri, Aug 3 2007 7:34 AM | Permanent Link |
Peter Thorne | I know the following is horrible but it seems to be the only way I can do what I am trying to do (see yesterday's post). Problem is it throws an AV in EDBManager when all the fields are included. If I cut it down by excluding the last 2 fields I
can sometimes get the procedure to create but not others. However, when I execute it this also causes an AV. Not very helpful I know but there is something not quite right here ... CREATE PROCEDURE "PopulateExportTables" (IN mid integer) BEGIN DECLARE SourceCursor CURSOR FOR Stmnt01; DECLARE DestCursor CURSOR FOR Stmnt02; DECLARE mglobal INTEGER DEFAULT -1; DECLARE mname VARCHAR DEFAULT ''; DECLARE mcountry VARCHAR DEFAULT ''; DECLARE mnotes CLOB; DECLARE mresolution VARCHAR DEFAULT ''; DECLARE mbasis VARCHAR DEFAULT ''; DECLARE mcustom VARCHAR DEFAULT ''; DECLARE mbengrd VARCHAR DEFAULT ''; PREPARE Stmnt01 FROM 'SELECT * FROM Models WHERE mid_local = ?'; OPEN SourceCursor USING mid; PREPARE Stmnt02 FROM ' SELECT * FROM ieModel'; OPEN DestCursor; FETCH FIRST FROM SourceCursor (mid_global, model_name, country, notes, resolution, basis, custom_var_name, bengrd_file) INTO mglobal, mname, mcountry, mnotes, mresolution, mbasis, mcustom, mbengrid; WHILE NOT EOF (SourceCursor) DO INSERT INTO DestCursor (mid_global, model_name, country, notes, resolution, basis, custom_var_name, bengrd_file) VALUES (mid, mglobal, mname, mcountry, mnotes, mresolution, mbasis, mcustom, mbengrid); FETCH NEXT FROM SourceCursor (mid_global, model_name, country, notes, resolution, basis, custom_var_name, bengrd_file) INTO mglobal, mname, mcountry, mnotes, mresolution, mbasis, mcustom, mbengrid; END WHILE; END DESCRIPTION 'Copies the details of the current model to the temporary tables for export' |
Fri, Aug 3 2007 7:41 AM | Permanent Link |
Peter Thorne | OK - here's the clue. The following creates and executes fine:
CREATE PROCEDURE "PopulateExportTables" (IN mid integer) BEGIN DECLARE SourceCursor CURSOR FOR Stmnt01; DECLARE DestCursor CURSOR FOR Stmnt02; DECLARE v1 INTEGER DEFAULT -1; DECLARE v2 VARCHAR DEFAULT ''; DECLARE v3 VARCHAR DEFAULT ''; DECLARE v4 CLOB; DECLARE v5 VARCHAR DEFAULT ''; DECLARE v6 VARCHAR DEFAULT ''; DECLARE v7 VARCHAR DEFAULT ''; DECLARE v8 VARCHAR DEFAULT ''; PREPARE Stmnt01 FROM 'SELECT * FROM Models WHERE mid_local = ?'; OPEN SourceCursor USING mid; PREPARE Stmnt02 FROM ' SELECT * FROM ieModel'; OPEN DestCursor; FETCH FIRST FROM SourceCursor (mid_global, model_name, country, notes, resolution, basis, custom_var_name, bengrd_file) INTO v1, v2, v3, v4, v5, v6, v7, v8; WHILE NOT EOF (SourceCursor) DO INSERT INTO DestCursor VALUES (mid, v1, v2, v3, v4, v5, v6, v7, v8); FETCH NEXT FROM SourceCursor (mid_global, model_name, country, notes, resolution, basis, custom_var_name, bengrd_file) INTO v1, v2, v3, v4, v5, v6, v7, v8; END WHILE; END DESCRIPTION 'Copies the details of the current model to the temporary tables for export' Must be a line length thing I guess? A more elegant solution would still be much appreciated though ... |
Fri, Aug 3 2007 1:38 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Peter,
<< I know the following is horrible but it seems to be the only way I can do what I am trying to do (see yesterday's post). Problem is it throws an AV in EDBManager when all the fields are included. If I cut it down by excluding the last 2 fields I can sometimes get the procedure to create but not others. However, when I execute it this also causes an AV. Not very helpful I know but there is something not quite right here ... >> Could you send me the database catalog and table files for the appropriate tables ? I want to run it here exactly as you are running it. Thanks, -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |