All Forums UDA
jeremyclover 1 post Joined 12/09
23 Dec 2009
Droping Tables

Have a procedure that's supposed to drop a table that it's pulling for a query. Here's what I have.BEGINDECLARE newcount INTEGER;DECLARE tablename1, tablename2 VARCHAR(200);DECLARE TableCur CURSOR FORSELECT tablename1,tablename2FROM database.viewFOR READ ONLY; OPEN TableCur; SELECT COUNT(*) FROM database.view INTO newcount; REPEAT FETCH TableCur INTO tablename1,tablename2; DROP TABLE :tablename1 ; DROP TABLE :tablename2 ; SET newcount = newcount - 1; UNTIL newcount = 0 END REPEAT; CLOSE TableCur;END;It's not liking the highlighted area. What's the issue with a drop statement that gets it's table name from a query?

29 Dec 2009

Hi,basically procedure does't support DDL for this you have to try dynamic SQL,Try this and let me know it will work

You must sign in to leave a comment.