proc 动态游标前3种方式的使用(第四种就是sqlda方式)

动态sql技术
动态sql更加通用,功能更强

/**一般的更新删除查找**/
sqlstr="insert into sprerec values ('....')"
EXEC SQL EXECUTE IMMEDIATE:sqlstr;

/**启动oracle通讯区**/
EXEC ORACLE OPTION (ORACA = YES)
/**使pro c 在执行后,释放与嵌入sql语句有关的资源**/
EXEC ORACLE OPTION (RELEASE_CURSOR = YES)
动态sql方法2:prepare (避免重复分析语句)
EXEC SQL PREPARE [STATEMENT_NAME] [BLOCK_NAME]
FROM [:HOST_STRING] [STRING_LITERAL]


EXEC SQL prepare sqlstr from :strSelect;
EXEC SQL EXECUTE sqlstr;

/**缺省参数**/
EXEC SQL prepare sqlstr from :strSelect;
EXEC SQL EXECUTE sqlstr using :variable;

动态sql方法3:
/**定义游标**/
EXEC SQL prepare pre1 from :strSelect;
EXEC SQL declare cursor1 cursor for pre1;
EXEC SQL open cursor1;
EXEC SQL FETCH cursor1 INTO:

你可能感兴趣的:(proc)