You can export any Oracle view as a Postgres Pro table simply by setting TYPE configuration option to TABLE
to have the corresponding create table statement. Or use type COPY
or INSERT
to export the corresponding data. To allow that you have to specify your views in the VIEW_AS_TABLE configuration option.
Then, if ora2pgpro finds the view, it extracts its schema (if TYPE=TABLE
) into a Postgres Pro CREATE TABLE form, then it will extract the data (if TYPE=COPY
or TYPE=INSERT
) following the view schema.
For example, with the following view:
CREATE OR REPLACE VIEW product_prices (category_id, product_count, low_price, high_price) AS SELECT category_id, COUNT(*) as product_count, MIN(list_price) as low_price, MAX(list_price) as high_price FROM product_information GROUP BY category_id;
Setting VIEW_AS_TABLE to product_prices and using export type TABLE, will force ora2pgpro to detect columns returned types and to generate a create table statement:
CREATE TABLE product_prices ( category_id bigint, product_count integer, low_price numeric, high_price numeric );
Data will be loaded following the COPY
or INSERT
export type and the view declaration.
You can use the ALLOW
and EXCLUDE
directives in addition to filter other objects to export.