Documente Academic
Documente Profesional
Documente Cultură
name of file
Copyright 2004-2005 Steven Feuerstein - Page 2
New but not overwhelming
(learning curve-wise)
and then:
ALTER PROCEDURE bigproc COMPILE REUSE SETTINGS;
REM If you want to enable warning message number 06002 and all warnings in
REM the performance category except warning number 07202, execute:
ALTER SESSION SET plsql_warnings =
'enable:06002', 'enable:performance' , 'disable:07202';
Backtrace.sql
Copyright 2004-2005 Steven Feuerstein - Page 11
Displaying the “error stack” inside PL/SQL
It only DECLARE
TYPE employee_aat IS TABLE OF employee.employee_id%TYPE
processes INDEX BY PLS_INTEGER;
l_employees employee_aat;
the rows TYPE boolean_aat IS TABLE OF BOOLEAN
INDEX BY PLS_INTEGER;
with row l_employee_indices boolean_aat;
numbers BEGIN
l_employees (1) := 7839;
matching l_employees (100) := 7654;
l_employees (500) := 7950;
the defined --
l_employee_indices (1) := TRUE;
rows of the l_employee_indices (500) := TRUE;
--
driving FORALL l_index IN INDICES OF l_employee_indices
DECLARE
It only TYPE employee_aat IS TABLE OF employee.employee_id%TYPE
the content --
l_employee_indices (100) := -77;
of a row in l_employee_indices (200) := 99999999;
--
the driving FORALL l_index IN VALUES OF l_employee_indices
UPDATE employee
array. SET salary = 10000
WHERE employee_id = l_employees (l_index);
END;
DECLARE
keep_it_simple strings_nt := strings_nt ();
BEGIN
keep_it_simple := SET (favorites_pkg.my_favorites);
favorites_pkg.show_favorites (
'DISTINCT SET', keep_it_simple);
END;
10g_set.sql
Copyright 2004-2005 Steven Feuerstein - Page 22 10g_favorites.pkg
Oracle10g Determining subsets of data
Use the SUBMULTISET operator to determine if a nested table contains only
elements that are in another nested table.
BEGIN
p.l (favorites_pkg.my_favorites
SUBMULTISET OF favorites_pkg.eli_favorites
, 'Father follows son?');
p.l (favorites_pkg.eli_favorites
SUBMULTISET OF favorites_pkg.my_favorites
, 'Son follows father?');
p.l (favorites_pkg.my_favorites
NOT SUBMULTISET OF favorites_pkg.eli_favorites
, 'Father doesn''t follow son?');
p.l (favorites_pkg.eli_favorites
NOT SUBMULTISET OF favorites_pkg.my_favorites
, 'Son doesn''t follow father?');
END; 10g_submultiset.sql
Copyright 2004-2005 Steven Feuerstein - Page 23 10g_favorites.pkg
Oracle10g Various Oracle10g improvements
What do you do when you need to put a single quote inside a literal string?
– Before Oracle10g, you could sometimes tear your hair out.
– Now just specify an alternative quote character.
IF REGEXP_LIKE(phone_number,'^\(?212\)?'
THEN
-- Begins with 212, optionally enclosed by parentheses
APPLY_NYC_SURCHARGE;
END IF;
street_number :=
REGEXP_SUBSTR(address_line1, '[[:digit:]]+[:space:]');
DBMS_OUTPUT.PUT_LINE (
REGEXP_REPLACE(email_address, '@.*\.com','@new_domain.com'));