Pro Oracle SQL Development: Best Practices for Writing Advanced Queries 2nd Edition Jon Heller instant download
Pro Oracle SQL Development: Best Practices for Writing Advanced Queries 2nd Edition Jon Heller instant download
https://ebookmeta.com/product/pro-oracle-sql-development-best-
practices-for-writing-advanced-queries-2nd-edition-jon-heller/
https://ebookmeta.com/product/pro-t-sql-2022-2nd-edition-
elizabeth-noble/
https://ebookmeta.com/product/pro-python-best-practices-
debugging-testing-and-maintenance-1st-edition-kristian-rother/
https://ebookmeta.com/product/clean-c20-sustainable-software-
development-patterns-and-best-practices-2nd-edition-stephan-roth/
https://ebookmeta.com/product/the-church-and-the-slums-the-
victorian-anglican-church-and-its-mission-to-liverpool-s-
poor-1st-edition-wilcox/
Emotion in the Digital Age : Technologies, Data and
Psychosocial Life 1st Edition Darren Ellis
https://ebookmeta.com/product/emotion-in-the-digital-age-
technologies-data-and-psychosocial-life-1st-edition-darren-ellis/
https://ebookmeta.com/product/psycho-oncology-2021-william-
breitbart-editor-phyllis-butow-editor-paul-jacobsen-editor-wendy-
lam-editor-mark-lazenby-editor-matthew-loscalzo-editor/
https://ebookmeta.com/product/at-midnight-in-venice-charles-
dickens-and-superintendent-jones-investigate-5-1st-edition-j-c-
briggs/
https://ebookmeta.com/product/surgical-instrumentation-an-
interactive-approach-3rd-edition-renee-nemitz/
https://ebookmeta.com/product/black-light-entranced-black-light-
series-book-33-1st-edition-rose-c-carole/
The Authoritarian Century China s Rise and the Demise
of the Liberal International Order 1st Edition Ogden
Chris
https://ebookmeta.com/product/the-authoritarian-century-china-s-
rise-and-the-demise-of-the-liberal-international-order-1st-
edition-ogden-chris/
Pro Oracle SQL
Development
Best Practices for Writing Advanced
Queries
Second Edition
Jon Heller
Pro Oracle SQL Development: Best Practices for Writing Advanced Queries
Jon Heller
Clive, IA, USA
Introduction������������������������������������������������������������������������������������������������������������xxi
v
Table of Contents
Part II: Write Powerful SQL with Sets and Advanced Features������������������� 105
Chapter 6: Build Sets with Inline Views and ANSI Join Syntax���������������������������� 107
Spaghetti Code from Nonstandard Syntax�������������������������������������������������������������������������������� 107
Too Much Context��������������������������������������������������������������������������������������������������������������������� 112
Sets, Chunking, and Functional Programming to the Rescue��������������������������������������������������� 115
Inline Views������������������������������������������������������������������������������������������������������������������������������� 119
ANSI Joins��������������������������������������������������������������������������������������������������������������������������������� 123
Example������������������������������������������������������������������������������������������������������������������������������������ 123
Summary���������������������������������������������������������������������������������������������������������������������������������� 126
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
Part III: Write Elegant SQL with Patterns and Styles���������������������������������� 299
Chapter 11: Stop Coding and Start Writing���������������������������������������������������������� 301
The Hypocrisy of Examples������������������������������������������������������������������������������������������������������� 302
Comments��������������������������������������������������������������������������������������������������������������������������������� 303
Choose Good Names����������������������������������������������������������������������������������������������������������������� 307
Whitespace������������������������������������������������������������������������������������������������������������������������������� 309
Make Bugs Obvious������������������������������������������������������������������������������������������������������������������ 311
The Path to Writing Good SQL��������������������������������������������������������������������������������������������������� 315
Summary���������������������������������������������������������������������������������������������������������������������������������� 316
ix
Table of Contents
Chapter 14: Use SQL More Often with Basic Dynamic SQL����������������������������������� 349
When to Use Dynamic SQL�������������������������������������������������������������������������������������������������������� 349
Basic Features�������������������������������������������������������������������������������������������������������������������������� 354
Bind Variables for Performance and Security��������������������������������������������������������������������������� 355
How to Simplify String Concatenation�������������������������������������������������������������������������������������� 357
Code Generation, Not Generic Code������������������������������������������������������������������������������������������ 361
Summary���������������������������������������������������������������������������������������������������������������������������������� 362
x
Table of Contents
xi
Table of Contents
Chapter 20: Use SQL More Often with Advanced Dynamic SQL���������������������������� 543
Parsing�������������������������������������������������������������������������������������������������������������������������������������� 543
DBMS_SQL�������������������������������������������������������������������������������������������������������������������������������� 548
DBMS_XMLGEN������������������������������������������������������������������������������������������������������������������������� 549
PL/SQL Common Table Expressions������������������������������������������������������������������������������������������ 551
Method4 Dynamic SQL�������������������������������������������������������������������������������������������������������������� 551
Polymorphic Table Functions���������������������������������������������������������������������������������������������������� 553
SQL Macros������������������������������������������������������������������������������������������������������������������������������� 555
Summary���������������������������������������������������������������������������������������������������������������������������������� 558
xii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 609
xiii
About the Author
Jon Heller is an expert SQL and PL/SQL programmer with
20 years of Oracle experience. He has worked as a database
developer, analyst, and administrator. In his spare time, he is
active on Stack Overflow where he is a top user in the Oracle
and PL/SQL tags. He enjoys creating open source software,
has a Master of Computer Science degree from North
Carolina State University, and lives in Iowa with his wife and
two sons.
xv
About the Technical Reviewer
Michael Rosenblum is a software architect/senior DBA at
Dulcian, Inc., where he is responsible for system tuning and
application architecture. He supports Dulcian developers
by writing complex PL/SQL routines and researching new
features. He is the coauthor of Oracle PL/SQL for Dummies
(Wiley Press, 2006) and Oracle PL/SQL Performance Tuning
Tips and Techniques (Oracle Press, 2014), contributing
author of Expert PL/SQL Practices (Apress, 2011), and author
of many database-related articles and conference papers.
Michael is an Oracle ACE and frequent presenter at conferences (Oracle OpenWorld,
ODTUG, IOUG Collaborate, RMOUG, NYOUG, etc.).
xvii
Another Random Scribd Document
with Unrelated Content
sword in his hand, and delivered one of those wild and ill-judged
philippics against the king which did so much mischief in the attempt
of Monmouth.
Altogether, so far the cause of William appeared as little promising
as that of Monmouth had done. Notwithstanding the many earnest
entreaties from men of high rank and of various classes—nobles,
bishops, officers of the army and navy,—a week had elapsed, and no
single person of influence had joined him. The people only, as in
Monmouth's case, had crowded about him with shouts of welcome.
William was extremely disappointed and chagrined; he declared that
he was deluded and betrayed, and he vowed that he would re-
embark, and leave those who had called for him to work out their
own deliverance, or receive their due punishment. But on Monday,
the 12th, his spirits were a little cheered by a gentleman of Crediton,
named Burrington, attended by a few followers, joining his standard.
This was immediately followed, however, by the news that Lord
Lovelace, with about seventy of his tenants and neighbours, had
been intercepted by the militia at Cirencester, taken prisoners, and
sent to Gloucester Castle. The slow movement of the disaffected
appears to have originated in William's not having landed in
Yorkshire, as was expected, but in the west, where he was not
expected. In the North Lords Delamere and Brandon in Cheshire,
Danby and Lumley in Yorkshire, Devonshire and Chesterfield in
Derbyshire, in Lancashire the Earl of Manchester, in Nottinghamshire
and Lincolnshire Rutland and Stamford, and others were all waiting
to receive him. The very army which had been encamped on
Hounslow Heath was the seat of a secret conspiracy of officers, with
Churchill himself at their head, who kept up constant communication
with the club at the "Rose" tavern in Covent Garden, of which Lord
Colchester was president. But all this concert was paralysed for a
time by William's appearance in so distant a quarter.
But the elements of revolt, which had suffered a momentary shock,
now began to move visibly. The very day that Lord Lovelace was
captured, Lord Colchester marched into Exeter, attended by about
seventy horse, and accompanied by the hero of "Lillibullero,"
Thomas Wharton. They were quickly followed by Russell, the son of
the Duke of Bedford, one of the earliest promoters of the revolution,
and still more significantly by the Earl of Abingdon, a staunch Tory,
who had supported James till he saw that nothing but the reign of
Popery would satisfy him. A still more striking defection from the
king immediately followed. Lord Cornbury, the eldest son of the Earl
of Clarendon, pretended to have received orders to march with three
regiments of cavalry stationed at Salisbury Moor, to the enemy in the
west. He was a young man entirely under the influence of Lord
Churchill, having been brought up in the household of his cousin, the
Princess Anne, where Churchill and his wife directed everything; and
there can be no doubt that this movement was the work of Churchill.
As the cavalry proceeded from place to place by a circuitous route to
Axminster, the officers became suspicious, and demanded to see the
orders. Cornbury replied that his orders were to beat up the quarters
of the army in the night near Honiton. The loyal officers, who had
received hints that all was not right, demanded to see the written
orders; but Cornbury, who had none to produce, stole away in the
dark with a few followers who were in the secret, and got to the
Dutch camp. His regiment, and that of the Duke of Berwick, James's
own (natural) son, with the exception of about thirty troops,
returned to Salisbury; but the third regiment, the Duke of St.
Albans', followed the colonel, Langton, to Honiton, where General
Talmash received them; and most of the officers and a hundred and
fifty privates declared for the prince, the rest being made prisoners,
but soon afterwards discharged.
The news of this defection of one so near to the king's family
created the greatest consternation in the palace. In his terror James
summoned a military council. He was anxious to receive the
assurances of fidelity from his other officers—as if any assurances,
under the circumstances, anything but leading them against the
enemy, could test the loyalty of these men. He told them that he
wished to be satisfied that there were no more Cornburys amongst
them; and that if any had scruples about fighting for him, he was
ready to receive back their commissions. Of course they protested
the most ardent devotion to his cause, though there was not a man
of them that was not already pledged to desert him. Churchill,
recently made a lieutenant-general, and the Duke of Grafton, the
king's nephew, were especially fervid in their expressions of loyalty;
so, too, were Trelawney, smarting secretly over the persecution of
his brother, the Bishop of Bristol, and the savage Kirke, who, when
James had importuned him to turn Papist, had replied that he "was
sorry, but he had already engaged to the Grand Turk that if he
changed his religion he would become a Mussulman." Reassured by
these hollow professions, James gave orders for joining the camp at
Salisbury; but the next morning, before he could set out, he was
waited on by a numerous deputation of lords spiritual and temporal,
with Sancroft at their head, praying that a free Parliament might be
immediately called, and communication opened with the Prince of
Orange.
James received the deputation ungraciously. In all his hurried
concessions he had still shown his stubborn spirit by refusing to give
up the Dispensing power; and now, though he declared that what
they asked he passionately desired, he added that he could not call
a Parliament till the Prince of Orange quitted the kingdom. "How," he
asked, "can you have a free Parliament whilst a foreign prince, at the
head of a foreign force, has the power to return a hundred
members?" He then fell foul of the bishops, reminding them that the
other day they refused to avow under their hands their disapproval
of the invasion, on the plea that their vocation was not in politics;
and yet here they were at the very head of a political movement. He
charged them with fomenting the rebellion, and retired, declaring to
his courtiers that he would not concede an atom. He then appointed
a council of five lords—of whom two were Papists, and the third
Jeffreys—to keep order during his absence, sent off the Prince of
Wales to Portsmouth to the care of the Duke of Berwick, the
commander, and set out for Salisbury. He reached his camp on the
19th of November, and ordered a review the next day at Warminster,
of Kirke's division. Churchill and Kirke were particularly anxious that
he should proceed to this review, and Kirke and Trelawney hastened
on to their forces, on pretence of making the necessary
preparations. On the other hand, Count de Roye as earnestly
dissuaded James from going to Warminster. He told him that the
enemy's advanced foot was at Wincanton, and that the position at
Warminster, or even that where they were at Salisbury, was
untenable. James, however, was resolved to go; but the next
morning, the 20th, he was prevented by a violent bleeding at the
nose, which continued unchecked for three days.