0

我在 oracle 中有一个使用游标的存储过程。当我通过 C# 代码调用它时,它会正确获取数据。但是,如果表得到更新,那么在我的 C# 应用程序中运行代码后,我也会得到旧值。我需要每次编译程序以获取更新的值...知道吗?

我的存储过程的 PFB 片段...

create or replace
PROCEDURE "SP_UTILITIES_LOG"
(
p_utility_name IN varchar2,
p_r_object_id IN varchar2,
p_platform_name IN varchar2,
p_exported_file_path IN varchar2,
p_Is_binary IN number,
p_extraction_status IN varchar2,
p_extraction_error IN varchar2,
p_extraction_datetime IN VARCHAR2,
p_schema_name IN varchar,
p_publication_path IN varchar,
p_schema_tcm_id IN varchar,
p_component_tcm_id IN varchar,
p_component_name IN varchar,
p_loading_status IN varchar,
p_transformed_file_path IN varchar,
p_transformed_status IN varchar,
p_import_status IN varchar,
p_loading_error IN varchar,
p_transform_error IN varchar,
p_import_error IN varchar,
p_loading_datetime IN TIMESTAMP,
p_transform_datetime IN TIMESTAMP,
p_import_datetime IN TIMESTAMP,
p_refcur out sys_refcursor
)
   IS  
   BEGIN

    IF(p_utility_name ='EXTRACTION')
    THEN
    BEGIN
   INSERT INTO utilities_log(R_OBJECT_ID,
PLATFORM_NAME,
EXPORTED_FILE_PATH,
IS_BINARY,
EXTRACTION_STATUS,
EXTRACTION_ERROR,
EXTRACTION_DATETIME
)
   VALUES(p_r_object_id, p_platform_name,p_exported_file_path, p_is_binary, p_extraction_status, p_extraction_error, p_extraction_datetime); 

    END;
    END IF;




    IF(p_utility_name ='PRE-TRANSFORMATION')
    THEN
    BEGIN
    OPEN p_refcur FOR
    SELECT exported_file_path,component_tcm_id FROM utilities_log
    WHERE platform_name= p_platform_name
    AND loading_status=p_loading_status
    AND extraction_status=p_extraction_status
    AND Is_binary=p_Is_binary; 


    END;
    END IF;
4

1 回答 1

1

假设您使用的是默认事务隔离级别(已提交读),将从游标中获取的数据是自游标打开时数据的一致视图。当您的应用程序将来从游标中获取数据时,不会返回在打开游标后提交的对表的更改。如果要获取当前数据,则需要关闭并重新打开游标。

于 2012-06-19T05:07:46.953 回答