DBA Hub

📋Steps in this guide1/1

Override External Table Parameters From a Query in Oracle Database 12c Release 2 (12.2)

Oracle Database 12c Release 2 (12.2) allows a query to modify of some external table parameters using the EXTERNAL MODIFY clause of the SELECT statement.

oracle 12cconfigurationintermediate
by OracleDba
11 views
1

Security Implications

Oracle Database 12c Release 2 (12.2) allows a query to modify some external table parameters using the clause of the statement. The following parameters can be modified. - : Only , and changes are supported. Can't use bind variables. - : Can't use bind variables. - : Can be a literal or bind variable. When using partitioned external tables only the table-level settings can be altered using this method. Partition and subpartiton settings will not be affected. - Setup - Non-Partitioned External Table - Partitioned External Table - PL/SQL Support - Security Implications Related articles. In order to demonstrate an external table we need some data in flat files. The following code spools out four CSV files with 1000 rows each. Create two directory objects to access these files. In this case both are pointing to the same directory, but it will still allow us to see the syntax. Create an external table to load the data. The attributes we can modify are shown in bold. Check the current contents of the external table without any modifiers. Modify the file parameters. Modify the parameter. Modify the parameter. Modify the parameter. Modify all available parameters. A full explanation of partitioned external tables can be seen here . When using partitioned external tables only the table-level settings can be altered using this method. Partition and subpartiton settings will not be affected. Modify all available parameters. This syntax can also be used in the PL/SQL. Here's an example of a cursor for-loop. Here's an example of a SELECT ... INTO. Access to directory objects should be controlled carefully, regardless of if you use external tables or not. As pointed out by Pete Finnigan , you need to consider the security implications of this functionality. At the time you define the external table you have made a conscious decision about the directory objects and file locations you are going to use. The ability to alter these parameters at runtime mean you need to pay special attention to the directory objects that are available to the user, or risk a security issue. Create a second test user. Create the basic external table from the first example in the initial test user, and grant access to the new test user. Now attempt to use the external table from the new test user. As we can see, the external table is run in the context of the current user, which doesn't have access to the directory objects. Let's grant access and try again. This demonstrates the basic external table has now worked. We can see below we are able to alter the runtime parameters from the new test user. If another directory object is available to the new test user, we can also alter the directory references. So you must make sure you control what directory objects are visible to the user accessing the external table, or you could find yourself in a position where you are exposing data you shouldn't be. For more information see: Hope this helps. Regards Tim...
Step 1

Comments (0)

Please to add comments

No comments yet. Be the first to comment!