根据oracle判断语句结果,进行循环语句

DECLARE
CURSOR TEMP IS SELECT CREDITZS_CODE,ATTRIBUTE_CODE,ATTRIBUTE_INFO_TYPE FROM CREDIT_DIRECTORY_ATTRIBUTE T,CREDIT_DIRECTORY_TREE E WHERE T.TREE_ID=E.ID AND ATTRIBUTE_INFO_TYPE='number'AND ATTRIBUTE_CODE IN('CF_NR_FK','CF_NR_WFFF');
STR VARCHAR2(100) := '';
BEGIN
FOR S IN TEMP LOOP
STR := 'ALTER TABLE '||S.CREDITZS_CODE||' MODIFY('||S.ATTRIBUTE_CODE||' NUMBER(30,4))';
DBMS_OUTPUT.PUT_LINE(STR);
BEGIN
EXECUTE IMMEDIATE STR ;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('错误更新语句'||STR);
END;
END LOOP;
END;

posted @ 2020-06-02 17:03  迷途的小码农  阅读(753)  评论(0编辑  收藏  举报