我有一个声明如此的游标:
DECLARE staging_cur CURSOR FOR
SELECT
col1, col2, ......
FROM crawl_db.staging_listing
WHERE is_deleted = FALSE;
然后我获取每一行,执行一些检查,然后将该行插入另一个(生产)数据库
OPEN staging_cur;
the_loop: LOOP
FETCH staging_cur
INTO col1_val, col2_val,.....;
-- perform some checks and some optional inserts
-- for example, if city with given name is not found in production DB, insert it
-- insert into production db
END LOOP the_loop;
我意识到我需要为表staging_listing(col1_val, col2_val ...
)的每个对应列声明一个变量(col1, col2....
)。问题是这个表包含90-100列,并且声明所有变量真的很麻烦
似乎应该有比这更好的方法。有没有什么方法可以访问游标当前行的列而不必声明单独的变量来保存列值?