|
| 1 | +.. _rm-convert-oracle-packages: |
| 2 | + |
| 3 | +======================= |
| 4 | +Convert Oracle Packages |
| 5 | +======================= |
| 6 | + |
| 7 | +.. contents:: On this page |
| 8 | + :local: |
| 9 | + :backlinks: none |
| 10 | + :depth: 1 |
| 11 | + :class: singlecol |
| 12 | + |
| 13 | +You can import and convert your Oracle Packages to MongoDB code |
| 14 | +with the query converter. The query converter considers the mapping |
| 15 | +rules and schema transformations defined in your project when |
| 16 | +converting your SQL code. |
| 17 | + |
| 18 | +About this Task |
| 19 | +--------------- |
| 20 | + |
| 21 | +.. include:: /includes/fact-query-converter-generic.rst |
| 22 | + |
| 23 | +- .. include:: /includes/fact-view-query-conversion-history.rst |
| 24 | + |
| 25 | +Before you Begin |
| 26 | +---------------- |
| 27 | + |
| 28 | +- MongoDB does not have an official synonym object type for Oracle |
| 29 | + packages. Instead, MongoDB supports custom JavaScript and |
| 30 | + driver code that hosts the database logic. When migrating your |
| 31 | + application to MongoDB, you must choose the programming language and |
| 32 | + hosting option that best serves your application needs. You can host |
| 33 | + your converted Oracle package code in your application or with |
| 34 | + :ref:`<atlas-functions>`. |
| 35 | + |
| 36 | +- .. include:: /includes/fact-query-converter-disclaimer.rst |
| 37 | + |
| 38 | +Steps |
| 39 | +----- |
| 40 | + |
| 41 | +.. procedure:: |
| 42 | + :style: normal |
| 43 | + |
| 44 | + .. step:: Navigate to the query converter pane |
| 45 | + |
| 46 | + From the :guilabel:`Code Generation` tab, click the :guilabel:`Query Converter` pane. |
| 47 | + |
| 48 | + .. step:: Open the query converter view |
| 49 | + |
| 50 | + - Click the :guilabel:`+ Add` button on the left-hand pane. |
| 51 | + |
| 52 | + - Click :guilabel:`Import From Database`. |
| 53 | + |
| 54 | + .. step:: Connect to your relational database |
| 55 | + |
| 56 | + If you are not already connected to your source database, specify the |
| 57 | + connection details to your source database and click :guilabel:`Connect`. |
| 58 | + |
| 59 | + For more information on database connections in Relational |
| 60 | + Migrator, see :ref:`rm-database-connections`. |
| 61 | + |
| 62 | + .. step:: Select Oracle packages |
| 63 | + |
| 64 | + a. On the :guilabel:`Import from database` modal, click |
| 65 | + the :icon-fa5:`chevron-right` icon next to :guilabel:`Database`. |
| 66 | + |
| 67 | + #. Click the :icon-fa5:`chevron-right` icon next to your schema. |
| 68 | + |
| 69 | + #. Click the :icon-fa5:`chevron-right` icon next to |
| 70 | + :guilabel:`Packages`. |
| 71 | + |
| 72 | + .. tip:: |
| 73 | + |
| 74 | + To toggle Oracle packages for conversion, click |
| 75 | + the :icon-fa5:`check-square` icon next to the |
| 76 | + package's name. |
| 77 | + |
| 78 | + #. Click :guilabel:`Save`. |
| 79 | + |
| 80 | + The code for each package in your database |
| 81 | + schema is imported into your project and is visible in the |
| 82 | + :guilabel:`Query Converter` pane under |
| 83 | + :guilabel:`Packages`. |
| 84 | + |
| 85 | + .. step:: Convert and test code |
| 86 | + |
| 87 | + a. Click a packages's name from the left-hand pane under |
| 88 | + :guilabel:`Packages`. |
| 89 | + |
| 90 | + The code displays in the |
| 91 | + :guilabel:`Imported Package` pane. |
| 92 | + |
| 93 | + #. Select a :guilabel:`Target Language` from the drop-down. |
| 94 | + |
| 95 | + Query converter supports Oracle package conversions to |
| 96 | + Javascript, C#, and Java. |
| 97 | + |
| 98 | + .. include:: /includes/fact-domain-object |
| 99 | + |
| 100 | + #. Click the :guilabel:`Convert` button. Wait for the query |
| 101 | + converter to convert your code. |
| 102 | + |
| 103 | + The converted MongoDB code displays |
| 104 | + on the :guilabel:`Converted MongoDB Query` pane. |
| 105 | + |
| 106 | + .. include:: /includes/fact-query-converter-failure-errors.rst |
| 107 | + |
| 108 | + #. Click the :icon-fa5:`copy` icon on the |
| 109 | + :guilabel:`Converted MongoDB Query` pane to copy the MongoDB |
| 110 | + code to your clipboard. |
| 111 | + |
| 112 | + #. Test and validate the generated MongoDB code. |
| 113 | + |
| 114 | + .. tip:: |
| 115 | + |
| 116 | + .. include:: /includes/fact-query-converter-filter.rst |
| 117 | + |
| 118 | +Examples |
| 119 | +-------- |
| 120 | + |
| 121 | +The query converter can convert your packages to Javascript, C#, or |
| 122 | +Java code. The example below shows conversions to each language. |
| 123 | + |
| 124 | +.. tabs:: |
| 125 | + |
| 126 | + .. tab:: Oracle Package |
| 127 | + :tabid: oracle-package-original |
| 128 | + |
| 129 | + .. include:: /includes/query-conversion-examples/oracle-package-original.rst |
| 130 | + |
| 131 | + .. tab:: Javascript |
| 132 | + :tabid: oracle-package-js |
| 133 | + |
| 134 | + .. include:: /includes/query-conversion-examples/oracle-package-js.rst |
| 135 | + |
| 136 | + .. tab:: C# |
| 137 | + :tabid: oracle-package-csharp |
| 138 | + |
| 139 | + .. include:: /includes/query-conversion-examples/oracle-package-csharp.rst |
| 140 | + |
| 141 | + .. tab:: Java |
| 142 | + :tabid: oracle-package-java |
| 143 | + |
| 144 | + .. include:: /includes/query-conversion-examples/oracle-package-java.rst |
| 145 | + |
0 commit comments