Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
Stored procedure and USING |
Thu, Aug 6 2009 6:57 AM | Permanent Link |
gienek majonez | Hi,
There is a small procedure like this: CREATE PROCEDURE "REPAIR"( ) BEGIN DECLARE DBCursor CURSOR FOR DBStmt; DECLARE TableCursor CURSOR FOR TableStmt; DECLARE DBName VARCHAR DEFAULT ''; DECLARE TableName VARCHAR DEFAULT ''; DECLARE stmt STATEMENT; PREPARE DBStmt FROM 'SELECT "Name" FROM Configuration.Databases'; PREPARE TableStmt FROM 'SELECT "Name" FROM ?.Information.Tables'; OPEN DBCursor; FETCH FIRST FROM DBCursor (Name) INTO DBName; WHILE NOT EOF(DBCursor) DO OPEN TableCursor USING DBName; FETCH FIRST FROM TableCursor (Name) INTO TableName; WHILE NOT EOF(TableCursor) DO SET LOG MESSAGE TO DBName + '.' + TableName + ': repairing...'; PREPARE stmt FROM 'REPAIR TABLE "'+DBName+'.'+TableName+'"'; EXECUTE stmt;/**/ SET LOG MESSAGE TO 'Done.'; FETCH NEXT FROM TableCursor (Name) INTO TableName; END WHILE; CLOSE TableCursor; FETCH NEXT FROM DBCursor (Name) INTO DBName; END WHILE; CLOSE DBCursor; END //------------------- Question: why USING in line OPEN TableCursor USING DBName; don't replace ? in TableStmt with variable DBName? Bug or feature? When I try to execute procedure in Manager i get error #700 with message "Expected table name but instead found ?" best regards, g_m |
Thu, Aug 6 2009 7:36 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | gienek
Neither bug or feature just how it is. It will probably change in the future but at present ElevateDB can only replace the comparison value. Roy Lambert [Team Elevate] |
Thu, Aug 6 2009 10:53 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Gienek,
<< why USING in line OPEN TableCursor USING DBName; don't replace ? in TableStmt with variable DBName? Bug or feature? >> It's normal. Try to think of parameters as the same as a constant value, not a general text replacement mechanism. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |