如何将用于将oracle中的XML数据提交的DBMS_METADATA过程和函数转换为postgresql
例如:
SET serveroutput ON;
DECLARE
v_handle NUMBER;
v_transform_handle NUMBER;
v_ddls sys.ku$_ddls;
v_ddl sys.ku$_ddl;
BEGIN
v_handle := DBMS_METADATA.OPEN ('OBJECT_GRANT');
v_transform_handle := DBMS_METADATA.ADD_TRANSFORM(v_handle, 'DDL');
DBMS_METADATA.SET_TRANSFORM_PARAM(v_transform_handle,'PRETTY', TRUE);
DBMS_METADATA.SET_TRANSFORM_PARAM(v_transform_handle,'SQLTERMINATOR',TRUE);
DBMS_METADATA.SET_FILTER(v_handle, 'BASE_OBJECT_NAME', 'TABLE_NAME' );
DBMS_METADATA.SET_FILTER(v_handle, 'BASE_OBJECT_SCHEMA', 'OWNER_NAME' );
DBMS_METADATA.SET_COUNT (v_handle, 10); -- 10 object by call to fetch
v_ddls := DBMS_METADATA.FETCH_DDL(v_handle);
WHILE (v_ddls IS NOT NULL)
LOOP
FOR indx IN 1 .. v_ddls.COUNT
LOOP
v_ddl := v_ddls(indx);
DBMS_OUTPUT.put_line ('Output: ' || v_ddl.ddlText);
END LOOP;
v_ddls := DBMS_METADATA.FETCH_DDL(v_handle);
END LOOP;
DBMS_METADATA.CLOSE (v_handle);
END;
/