Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Splitting up a file using PL/SQL after having created it?

Lentoporo1895Mar 8 2018 — edited Mar 8 2018

Hello dear experts,

I am working for a customer, that exports data to later import them into their SAP environment. The export is quite complex and even uses the APEX-tables. The export is done by several queries, that construe a new query, that is eventually used to do the export of the data and saves it into a file. The export and the creation of the file are fine and they also work performantly.

The project leader has signalised a performance problem during the import of the file. Apparantly SAP has a problem with the import of lots of records. The project leader has suggested to implement some kind of counter to reduce the file size. When the export would have been done using PL/SQL, that might be one solution, but it is not. I do not want to touch the concept behind the export using SQL, because of the complexity of the matter.

What I would like to ask you is: is there a way of splitting up the file into several smaller files using PL/SQL? If yes, how?

Thank you very much for your help!

Hannu

Comments

bouye-JavaNet
Answer

It's not that hard to do it:

public class Main extends Application {

    @Override

    public void start(final Stage primaryStage) {

        // Creates items for menu button.

        final ToggleGroup toogleGroup = new ToggleGroup();

        final MenuItem[] menus = IntStream.range(0, 10)

                .mapToObj(index -> {

                    final RadioMenuItem menuItem = new RadioMenuItem();

                    menuItem.setText(String.format("Radio #%d", index + 1));

                    menuItem.setToggleGroup(toogleGroup);

                    menuItem.setOnAction(event -> System.out.printf("Action -> %s%n", menuItem.getText()));

                    return menuItem;

                })

                .toArray(MenuItem[]::new);

        toogleGroup.getToggles().get(0).setSelected(true);

        // Creates menu button.

        final SplitMenuButton splitMenuButton = new SplitMenuButton();

        // Forward action to selected item when button is clicked.

        // Works ok but logs warnings when the selected toggle is briefly null when the selection changes.

//        splitMenuButton.onActionProperty().bind(Bindings.select(toogleGroup.selectedToggleProperty(), "onAction"));

        // Works ok without warnings.

        splitMenuButton.setOnAction(event -> {

            Optional.ofNullable((RadioMenuItem) toogleGroup.getSelectedToggle())

                    .ifPresent(menuItem -> {

                        Optional.ofNullable(menuItem.getOnAction())

                                .ifPresent(eventHandler -> eventHandler.handle(event));

                    });

        });

        // Bind item's text to button.

        splitMenuButton.textProperty().bind(new StringBinding() {

            {

                bind(toogleGroup.selectedToggleProperty());

            }

            @Override

            public void dispose() {

                unbind(toogleGroup.selectedToggleProperty());

                super.dispose();

            }

            @Override

            protected String computeValue() {

                final RadioMenuItem menuItem = (RadioMenuItem) toogleGroup.getSelectedToggle();

                String result = (menuItem == null) ? null : menuItem.getText();

                return result;

            }

        });

        // Bind item's graphic to button.

        splitMenuButton.graphicProperty().bind(new ObjectBinding<Node>() {

            {

                bind(toogleGroup.selectedToggleProperty());

            }

            @Override

            public void dispose() {

                unbind(toogleGroup.selectedToggleProperty());

                super.dispose();

            }

            @Override

            protected Node computeValue() {

                final RadioMenuItem menuItem = (RadioMenuItem) toogleGroup.getSelectedToggle();

                final Node result = null;

                // Find a way to duplicate graphic here.

                // final Node result = (menuItem == null) ? null : duplicateGraphic(menuItem.getGraphic());

                return result;

            }

        });

        splitMenuButton.getItems().setAll(menus);

        final StackPane root = new StackPane();

        root.getChildren().add(splitMenuButton);

        final Scene scene = new Scene(root, 300, 250);

        primaryStage.setTitle("Test");

        primaryStage.setScene(scene);

        primaryStage.show();

    }

    public static void main(final String[] args) {

        launch(args);

    }

}

Marked as Answer by Muzib · Sep 27 2020
Muzib

Wow! works fine. I appreciate it. Thanks a lot.

@

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 5 2018
Added on Mar 8 2018
13 comments
1,609 views