set serveroutput on; DECLARE v_property_value VARCHAR2(255); v_condition VARCHAR2(255) := 'property_path =''property.RuntimePlatform.0.version'''; str1 varchar2(200) := null; str2 varchar2(200) := null; v_num NUMBER :=0; CURSOR v_usernames IS SELECT OWNER FROM ALL_TABLES WHERE TABLE_NAME= 'WB_RT_PLATFORM_PROPERTIES'; BEGIN FOR user_rec IN v_usernames LOOP BEGIN str1 := 'select property_value from ' || user_rec.OWNER || '.wb_rt_platform_properties where '||v_condition; execute immediate str1 into v_property_value; IF v_property_value = '9.2.0.2.8' OR v_property_value = '9.2.0.3.0' THEN v_num := v_num + 1; DBMS_OUTPUT.PUT_LINE( 'Found USER: ' || user_rec.OWNER ); DBMS_OUTPUT.PUT_LINE( 'Old: v_property_value = ' || v_property_value ); str2 := 'update ' || user_rec.OWNER || '.wb_rt_platform_properties set property_value=''9.2.0.4.0'' where '||v_condition; execute immediate str2; DBMS_OUTPUT.PUT_LINE( 'New: v_property_value = 9.2.0.4.0'); END IF; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE( 'EXCEPTION...ERR_NUM=' || SQLCODE); DBMS_OUTPUT.PUT_LINE( 'EXCEPTION...ERR_MSG=' || SUBSTR(SQLERRM,1,100) ); END; END LOOP; commit; DBMS_OUTPUT.PUT_LINE('Total '||v_num ||' user(s) have been upgraded.'); END; /