Tags for dynamic cursors
Stored Procedures - Use dynamic cursor for any table
I'm attempting to develop a stored procedure that takes a table name as a parameter, and performs column-by-column updates to whatever table is passed in. I have the dynamic SELECT query working correctly: SET CURSOR_SQL = 'SELECT * FROM ' || P_TABLE_NAME || ' ORDER BY rsid;'; PREPARE CURSOR_STATEMENT FROM CURSOR_SQL; OPEN CDC_CURSOR; /* logic */ CLOSE CDC_CURSOR; Now I'm at the point where I need to fetch the cursor data into local variables...but I can't create table-specific local variables because I don't know what tables will be passed into this procedure.
stored procedure dynamic sql dynamic cursors cursor dynamic stored procedure cdc
re: Help converting SQL Server Loop Query to Teradata!
Hi, I'm new to Teradata but am in the process of converting all of my SQL to run on my new Teradata App db.... I have a SQL snippet loop query that runs on SQL Server but it will not run as is on Teradata. I think I need to do something with cursor but am unsure. Can someone tell me how to convert this statement to run on Teradata? Thanks in advance. CD1: UPDATE NFAA_TABLES.NFAA_REGIONCD SET LoopSpan = 'A' from NFAA_TABLES.NFAA_REGIONCD nf1 WHERE LoopSpan is null and exists ( select * from NFAA_TABLES.NFAA_REGIONCD nf2 WHERE nf2.LoopSpan = 'A'
sql dynamic cursors loop
Dynamic Cursors
i have couple of questions: how to pass queries in the procedure ( i would be passing different queries at different times) execute them as cursors how to find out the no of coulmns in the cursor and fetch them into strings or array( as no of columns in the queries would be changing each for each call)
dynamic sql dynamic cursors procedures