Cursor in Dynamic SQL

Database
Teradata Employee

Cursor in Dynamic SQL

Hi i have a cursor which returns me the date.

Belwo is the sample

FOR Cur_Dt AS Cur CURSOR FOR

SELECT STRT_DT

FROM table

WHERE STRT_DT

BETWEEN 1900 -01  01

AND 9999 01  01


Now i have a dynamic SQL..

which is using Cur_Dt(cursor value).   But when this is passed as a normal SQL----( where date_val =  Cur_Dt.STRT_DT ) -- its showing error Cur_Dt doesnot exist.

IS there any way we can pass cursor value to dynamic SQl.

Any help welcomed.

Thanks

2 REPLIES
Enthusiast

Re: Cursor in Dynamic SQL

I believe it should work. Could you post the whole loop? Preferably in a code block :) (there is a code button).

Teradata Employee

Re: Cursor in Dynamic SQL

Hi..have solved it.

It workes when you give double quotes. '' cursor ''  :)