Skip to content

Latest commit

 

History

History
132 lines (85 loc) · 3.58 KB

oos_util.md

File metadata and controls

132 lines (85 loc) · 3.58 KB

OOS_UTIL

Types

Name Code Description
tab_num
type tab_num is table of number;
number nested table
tab_num_arr
type tab_num_arr is table of number index by pls_integer;
number associated array
tab_vc2
type tab_vc2 is table of varchar2(32767);
varchar2 nested table
tab_vc2_arr
type tab_vc2_arr is table of varchar2(32767) index by pls_integer;
varchar2 associated array

Constants

Name Code Description
gc_date_format
gc_date_format constant varchar2(255) := 'YYYY-MM-DD HH24:MI:SS';
default date format
gc_timestamp_format
gc_timestamp_format constant varchar2(255) := gc_date_format
gc_timestamp_tz_format
gc_timestamp_tz_format constant varchar2(255) := gc_timestamp_format
gc_version_major
gc_version_major constant pls_integer := 1;
Version number major 1.0.0
gc_version_minor
gc_version_minor constant pls_integer := 0;
Verison number minor 0.1.0
gc_version_patch
gc_version_patch constant pls_integer := 0;
Version number patch 0.0.1
gc_version
gc_version constant varchar2(30) := gc_version_major
gc_vals_cat_mime_type
gc_vals_cat_mime_type constant oos_util_values.cat%type := 'mime-type';

ASSERT Procedure

Validates assertion.
Will raise an application error if assertion is false

Syntax

procedure assert(
  p_condition in boolean,
  p_msg in varchar2)

Parameters

Name Description
p_condition Boolean condition to validate
p_msg Message to include in application error if p_condition fails

Example


oos_util.assert(1=2, 'this assertion did not pass');

-- Results in

Error starting at line : 1 in command -
exec oos_util.assert(1=2, 'this assertion did not pass')
Error report -
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'ASSERT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

SLEEP Procedure

Sleep procedure for n seconds

Notes:

  • It is recommended that you use Oracle's lock procedures: http://psoug.org/reference/sleep.html
    • In instances where you do not have access use this sleep method instead
  • This implementation may tie up CPU so only use for development purposes
  • This is a custom implementation of sleep and as a result the times are not 100% accurate
  • If calling in SQLDeveloper may get "IO Error: Socket read timed out". This is a JDBC driver setting, not a bug in this code.

Syntax

procedure sleep(
  p_seconds in simple_integer)

Parameters

Name Description
p_seconds Number of seconds to sleep for

Example

begin
  dbms_output.put_line(oos_util_string.to_char(sysdate));
  oos_util.sleep(5);
  dbms_output.put_line(oos_util_string.to_char(sysdate));
end;
/

26-APR-2016 14:29:02
26-APR-2016 14:29:07