Académique Documents
Professionnel Documents
Culture Documents
Steven Feuerstein
PL/SQL Evangelist, Quest Software
steven.feuerstein@quest.com
Copyright 2000-2009 Steven Feuerstein - Page 1
How to benefit most from this session
What is hard-coding?
Why is it a problem?
Soft Coding and Easy Coding
Identify all sorts of hard-coding in PL/SQL
Specific techniques for getting rid of those
hard-codings
Literal values
– Especially language-specific literals
Constrained declarations
– Especially VARCHAR2(n)
Fetch into a list of variables
Rules and formulas
– Especially the "trivial" ones
SQL statements
– ??? Very scary to contemplate – to be explained later
Algorithmic details
– Example: error logging mechanisms
Copyright 2000-2008 Steven Feuerstein - Page 10
Literal Values
thisuser*.*
Copyright 2000-2008 Steven Feuerstein - Page 12
Soft-Code Values in Table
soft_code_literals.sql
Copyright 2000-2008 Steven Feuerstein - Page 13
Constrained Declarations
15
Applying SUBTYPEs
Instead of this:
DECLARE
l_full_name VARCHAR2(100);
l_big_string VARCHAR2(32767);
fullname.pks
plsql_limits.pks
string_tracker3.*
Copyright 2000-2008 Steven Feuerstein - Page 16
Rules and Formulas
get_time.sql
sf_timer.*
Copyright 2000-2008 Steven Feuerstein - Page 18
SQL Statements
RETURN onerow_rec;
END onerow;
END emplu11g;
30
11g_emplu.pkg
Manipulating collection contents
string_tracker3.*
cc_smartargs.pkb
Copyright 2000-2008 Steven Feuerstein - Page 31
Hiding stuff – a great career move!