You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/helpers/dragnet/pl_sql_usage_helper.rb
+168Lines changed: 168 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -179,6 +179,8 @@ def pl_sql_usage
179
179
For functions without dependencies there is a high likelihood that they are deterministic.
180
180
This selection shows PL/SQL functions not declared as DETERMINISTIC and without any dependency other than sys.STANDARD.
181
181
In addition SQLs from SGA are shown which uses this function name in their SQL syntax.
182
+
183
+
This check does not evaluate package functions, only standalone functions are considered.
182
184
"),
183
185
:sql=>"\
184
186
WITH Procs AS (SELECT /*+ NO_MERGE MATERIALIZE */ p.Owner, p.Object_Name
@@ -208,6 +210,172 @@ def pl_sql_usage
208
210
ORDER BY 4 DESC NULLS LAST
209
211
",
210
212
},
213
+
{
214
+
:name=>t(:dragnet_helper_178_name,:default=>'Candidates for DETERMINISTIC in package and standalone PL/SQL functions'),
215
+
:desc=>t(:dragnet_helper_178_desc,:default=>"User-defined PL/SQL functions may be cached in session for subsequent calls with same parameters if they are declared as deterministic.
216
+
This selection shows PL/SQL functions not declared as DETERMINISTIC but used in long running SQL statements.
217
+
218
+
The result should be checked if these functions could be declared DETERMINISTIC.
219
+
This could be useful even if there are SQL selections within the function that regularly prevent the deterministic state.
220
+
E.g. selections on rarely changed master data can be considered deterministic for the duration of a SQL execution.
221
+
222
+
This check evaluates also functions in packages.
223
+
"),
224
+
plsql: true,
225
+
:sql=>"\
226
+
DECLARE
227
+
TYPE proc_RT IS RECORD(
228
+
Owner VARCHAR2(128),
229
+
Package_Name VARCHAR2(128),
230
+
Function_Name VARCHAR2(128)
231
+
);
232
+
TYPE Proc_TT IS TABLE OF Proc_RT INDEX BY VARCHAR2(2000);
233
+
proc_table Proc_TT;
234
+
235
+
TYPE Char_Table_Type IS TABLE OF CHAR(1);
236
+
Char_Table Char_Table_Type := Char_Table_Type(' ', '(', '!', '=', '<', '>', '+', '-', '*', '/'); -- delimiters chars to search for
237
+
char_table_count INTEGER := Char_Table.COUNT;
238
+
239
+
Start_Pos INTEGER;
240
+
End_pos INTEGER;
241
+
Test_Pos INTEGER;
242
+
l_text CLOB;
243
+
l_match VARCHAR2(4000);
244
+
full_match VARCHAR2(4000);
245
+
l_json VARCHAR2(4000);
246
+
l_count INTEGER;
247
+
l_stmts INTEGER;
248
+
249
+
FUNCTION JSON_Esc(p_In VARCHAR2) RETURN VARCHAR2 IS
{:name=>t(:dragnet_helper_param_history_backward_name,:default=>'Consideration of history backward in days'),:size=>8,:default=>2,:title=>t(:dragnet_helper_param_history_backward_hint,:default=>'Number of days in history backward from now for consideration')},
376
+
{:name=>t(:dragnet_helper_178_param_1_name,:default=>'Min. elapsed seconds for SQL execution'),:size=>8,:default=>1000,:title=>t(:dragnet_helper_178_param_1_hint,:default=>'Minimum number of total elapsed seconds for a SQL in SGA and AWR reports to be considered in selection')},
ob_cs.register_out_parameter(1,OracleTypes::ARRAY,"DBMS_OUTPUT.CHARARR");# oracle.jdbc.OracleTypes::ARRAY needs to be imorted by java_import (no leading keyword "java" in class)
0 commit comments