Download ebooks file Modern Oracle Database Programming: Level Up Your Skill Set to Oracle’s Latest and Most Powerful Features in SQL, PL/SQL, and JSON 1st Edition Alex Nuijten all chapters
Download ebooks file Modern Oracle Database Programming: Level Up Your Skill Set to Oracle’s Latest and Most Powerful Features in SQL, PL/SQL, and JSON 1st Edition Alex Nuijten all chapters
com
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/oracle-pl-sql-by-example-6th-edition-
benjamin-rosenzweig/
ebookmeta.com
https://ebookmeta.com/product/practical-oracle-sql-mastering-the-full-
power-of-oracle-database-1st-edition-kim-berg-hansen/
ebookmeta.com
https://ebookmeta.com/product/primal-igniting-1st-edition-melody-rose/
ebookmeta.com
Unstable Masks Whiteness and American Superhero Comics New
Suns Race Gender and Sexuality Sean Guynes (Editor)
https://ebookmeta.com/product/unstable-masks-whiteness-and-american-
superhero-comics-new-suns-race-gender-and-sexuality-sean-guynes-
editor/
ebookmeta.com
https://ebookmeta.com/product/how-data-quality-affects-our-
understanding-of-the-earnings-distribution-1st-edition-reza-che-
daniels/
ebookmeta.com
https://ebookmeta.com/product/house-with-one-hundred-doors-1st-
edition-travis-brown/
ebookmeta.com
https://ebookmeta.com/product/big-data-management-and-processing-1st-
edition-k-c-li/
ebookmeta.com
https://ebookmeta.com/product/knowledge-and-digital-technology-1st-
edition-johannes-gluckler/
ebookmeta.com
Automated Sound Design 1st Edition Eric Lyon.
https://ebookmeta.com/product/automated-sound-design-1st-edition-eric-
lyon/
ebookmeta.com
Alex Nuijten and Patrick Barel
Patrick Barel
Almere, Flevoland, The Netherlands
This work is subject to copyright. All rights are solely and exclusively
licensed by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and
retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.
The publisher, the authors, and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress
Media, LLC, part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
Foreword
SQL is a powerful language. With a few lines, you can answer complex
questions.
PL/SQL includes many extensions to make SQL even easier to work
with. This tight integration makes these languages perfect for data
management.
Yet it can be unclear which SQL or PL/SQL features you should use
to solve a problem. The documentation for Oracle Database is huge.
Browsing through it in the hopes of finding the syntax or feature to help
you is an endless task.
Sadly, this means many applications have pages of code re-creating
features Oracle Database offers. Often this is because the developers
were unaware this functionality was available to them.
So, I’m thrilled to see Alex and Patrick write this book. They have a
long history of sharing their knowledge to help others use Oracle
Database. Their real-world experience and willingness to help others
understand Oracle SQL and PL/SQL have led both to the deserved
recognition of Oracle ACE Director. This makes them ideal candidates to
make this guide.
Reading this book will teach you how to use the more powerful
database options, many of which are unavailable on other platforms.
It’s filled with examples to show you how this SQL and PL/SQL
language features work. But most importantly, the scripts help
illustrate when and why you should use these options.
When working with any technology, I think you should know what
features it offers. Using inbuilt functionality saves you time and
simplifies your code. Alex and Patrick have done a great job showing
you how to do this.
I’ve learned a lot from them both over the years. I hope this book
helps you write better SQL and PL/SQL too.
—Chris Saxon, Oracle Developer Advocate
Introduction
When writing a book on database technology, you have to come up with
a data set to write your examples with. We could have used the
standard EMP and DEPT tables that have been available in the SCOTT
schema forever. Still, since this is a book on modern Oracle Database
programming, we wanted to use a different data set.
Because we are both fans of Formula 1 and Oracle is a big sponsor
of the Red Bull Racing team, which happens to be the team where our
countryman Max Verstappen is driving, we went looking for a Formula
1–related data set. Of course, not all examples in this book are related
to Max; many other drivers and results also play an important role.
The Ergast Developer API (https://ergast.com/mrd/) lets
you query all kinds of motor racing data and retrieve that in multiple
formats. This site also offers all the tables in a CSV format, so we
created an F1DATA schema where we could import the data. The
original data set was a MySQL database, so we had to make some minor
tweaks to the data model.
The source files for this book can be found on GitHub at
https://github.com/Apress/modern-oracle-database-
programming.
Part I: Advanced Basics
In the first part of the book, several topics are bundled together, which
should be in the toolbox of every Oracle Database developer. Frequently
we meet experienced developers unfamiliar with collections and bulk
operations, which have been around forever. The same is true for ANSI
joins, analytic functions, row pattern matching, or conditional
compilation.
Part II: Multiple Techniques and Languages
The second part of the book highlights the integration between SQL and
PL/SQL. Keeping context switches between the SQL and PL/SQL engine
to a minimum is always better for performance.
After the introduction of JSON into Oracle Database, it has taken
flight in functionality and performance. There is a lot to learn when
dealing with JSON in the database, and there are several chapters to get
a headstart.
Part III: Oracle-Provided Functionality
Out of the box, Oracle Database has a lot of functionality ready to use. In
the third part of this book, some of these functionalities play a central
role.
Even if APEX is not used for front-end development, it offers some
very useful packages that can be used in everyday database
development. Edition-based redefinition enables zero downtime
upgrades of your bespoke application. Getting data that is currently
based on a period where it is valid can be handled by the database
without having to write complicated SQL statements.
Copy the Pre-Authenticated Request URL and store it in a safe place. It will not be
shown again.
Copy the generated token and store it in a safe place. It will not be shown again.
Figure I-8 Generated token
“When I first visited the East,” Maximin wrote,[67] some years later,
in referring to his accession, “I found that a great number of persons
who might have been useful to the State had been exiled to various
places by the judges. I ordered each one of these judges no longer
to press hardly upon the provincials, but rather to exhort them by
kindly words to return to the worship of the gods. While my orders
were obeyed by the magistrates, no one in the countries of the East
was exiled or ill-treated, but the provincials, won over by kindness,
returned to the worship of the gods.”
“But since the mad obstinacy of certain people has reached such a
pitch that they are not to be shaken in their resolution either by the
justice of the imperial command or by the fear of imminent
punishment, and since, actuated by these motives, a very large
number have brought themselves into positions of extreme peril, it
has pleased their Majesties in their great pity and compassion to
send this letter to your Excellency.
“Their instructions are that if any Christian has been apprehended,
while observing the religion of his sect, you are to deliver him from all
molestation and annoyance and not to inflict any penalty upon him,
for a very long experience has convinced the Emperors that there is
no method of turning these people from their madness.
“Your Excellency will therefore write to the magistrates, to the
commander of the forces, and to the town provosts, in each city, that
they may know for the future that they are not to interfere with the
Christians any more.”
“To the Saviours of the entire human race, to the august Cæsars,
Galerius Valerius Maximinus, Flavius Valerius Constantinus, Valerius
Licinianus Licinius, this petition is addressed by the people of the
Lycians and the Pamphylians.
“Inasmuch as the gods, your congeners, O divine Emperor, have
always crowned with their manifest favours those who have their
religion at heart and offer prayers to them for the perpetual safety of
our invincible masters, we have thought it well to approach your
immortal Majesty and to ask that the Christians, who for years have
been impious and do not cease to be so, may be finally suppressed
and transgress no longer, by their wicked and innovating cult, the
respect that is owing to the gods.
“This result would be attained if their impious rites were forbidden
and suppressed by your divine and eternal decree, and if they were
compelled to practise the cult of the gods, your congeners, and pray
to them on behalf of your eternal and incorruptible Majesty. This
would clearly be to the advantage and profit of all your subjects.”
Evidently the Christians had not yet come to the end of their
troubles. Those who read this circular letter, for it seems to have
been sent round from city to city, must have expected the
persecution to break out anew at any moment. We do not know to
what extent the edict was observed. If it had been generally acted
upon, we should certainly have heard more of it, inasmuch as it must
have entailed a widespread exodus from the provinces of Maximin.
But of this there is no evidence. We imagine rather that this circular
was merely a preliminary sharpening of the sword in order to keep
the Christians in a due state of apprehension.
Maximin, however, continued his anti-Christian propaganda with
unabated zeal, and with greater cunning and better devised system
than before. His court at Antioch was the gathering place of all the
priests, magicians, and thaumaturgists of the East, who found in him
a generous patron. We hear of a new deity being invented by
Theotecnus, or rather of an old deity being invested with new
attributes. Zeus Philios, or Jupiter the Friendly was the name of this
god, to whom a splendid statue was erected in Antioch, and to
whose shrine a new priesthood, with new rites, was solemnly
dedicated. The god was provided with an attendant oracle to speak
in his name; what more natural than that the first response should
order the banishment of all Christians from the city? Very noteworthy,
too, was the re-appearance of a vigorous anti-Christian literature.
Maximin set on his pamphleteers to write libellous parodies of the
Christian doctrines and encouraged the more serious
controversialists on the pagan side to attack the Christian religion
wherever it was most vulnerable. The most famous of these
productions was one which bore the name of The Acts of Pilate and
purported to be a relation by Pilate himself of the life and conduct of
Christ. It was really an old pamphlet rewritten and brought up to
date, full, as Eusebius says, of all conceivable blasphemy against
Christ and reducing Him to the level of a common malefactor.
Maximin welcomed it with delight. He had thousands of copies
written and distributed; extracts were cut on brass and stone and
posted up in conspicuous places; the work was appointed to be read
frequently in public, and—what shews most of all the fury and
cunning of Maximin—it was appointed to be used as a text-book in
schools throughout Asia and Egypt. There was no more subtle
method of training bigots and poisoning the minds of the younger
generation amongst Christianity. Some of the Emperor’s devices,
however, were much more crude. For example, the military
commandant of Damascus arrested half a dozen notorious women
of the town and threatened them with torture if they did not confess
that they were Christians, and that they had been present at
ceremonies of the grossest impurity in the Christian assemblies.
Maximin ordered the precious confession thus extorted to be set up
in a prominent place in every township.
But the Emperor was not merely a furious bigot. There is evidence
that he fully recognised the wonderful strength of the Christian
ecclesiastical organisation and contrasted it with the essential
weakness of the pagan system. In this he anticipated the Emperor
Julian. Paganism was anything but a church. Its framework was
loose and disconnected. There were various colleges of priests,
some of which were powerful and had branches throughout the
Empire, but there was little connection between them save that of a
common ritual. There was also little doctrine save in the special
mysteries, where membership was preceded by formal initiation.
Maximin sought to institute a pagan clergy based upon the Christian
model, with a definite hierarchy from the highest to the lowest. There
were already chief priests of the various provinces, who had borne
for long the titles of Asiarch, Pontarch, Galatarch, and Ciliciarch in
their respective provinces. Maximin developed their powers on the
model of those of the Christian bishops, giving them authority over
subordinates and entrusting them with the duty of seeing that the
sacrifices were duly and regularly offered. He tried to raise the
standard of the priesthood by choosing its members from the best
families, by insisting on the priests wearing white flowing robes, by
giving them a guard of soldiers and full powers of search and arrest.
Evidently, Maximin was something more than the lustful,
bloodthirsty tyrant who appears in the pages of Lactantius and the
ecclesiastical historians. He dealt the Church much shrewder—
though not less ineffectual—blows than his colleagues in
persecution. With such an Emperor another appeal to the faggot and
the sword was inevitable, and the death of Galerius was the signal
for a renewal of the persecution. This time Maximin struck directly at
the most conspicuous figures in the Christian Church and counted
among his victims Peter, the Patriarch of Alexandria, and three other
Egyptian bishops—Methodus, Bishop of Tyre, Basiliscus, Bishop of
Comana in Bithynia, and Silvanus, Bishop of Emesa in Phœnicia. In
Egypt the persecution was so sharp that it drew Saint Antony from
his hermit’s cell in the desert to succour the unfortunate in
Alexandria. He escaped with his life, probably because he was
overlooked or disdained, or because the mighty influence which he
was to exercise upon the Church had not yet declared itself. This
persecution was followed by a terrible drought, famine, and
pestilence. Eusebius,[69] in a vigorous chapter, describes how
parents were driven by hunger to sell not only their lands but also
their children, how whole families were wiped out, how the pestilence
seemed to mark down the rich for its special vengeance, and how in
certain townships the inhabitants were driven to kill all the dogs
within their walls that they might not feed on the bodies of the
unburied dead. Amid these horrors the Christians alone remained
calm. They alone displayed the supreme virtue of charity in tending
the suffering and ministering to the dying. From the pagans
themselves, says Eusebius, was wrung the unwilling admission that
none but the Christians, in the sharp test of adversity, shewed real
piety and genuine worship of God.[70]
Maximin’s reign, however, was fast drawing to a close. After
becoming involved in a war with Tiridates of Armenia, from which he
emerged with little credit to himself, he entered into an alliance with
Maxentius, the ruler of Italy, against Constantine and Licinius, but did
not invade the territory of the latter until Maxentius had already been
overthrown. As we have seen, Maximin was utterly routed and, after
a hurried flight to beyond the Taurus, he there, according to
Eusebius,[71] gathered together his erstwhile trusted priests,
thaumaturgists, and soothsayers, and slew them for the proved
falsehood of their prophecy. More significant still, when he found that
his doom was certain, he issued a last religious edict in the vain
hope of appeasing the resentment of the Christians and their God.
The document is worth giving in full:
The bigot must have been brought very low and reduced to the
last depths of despair before he set his seal to such a document as
this. One can see that it was drawn up by Maximin with a copy of the
Edict of Milan before him, and that he hoped, by this tardy and
clumsy recognition of the principle of absolute liberty of conscience
for all men, to make the Christians forget his brutalities. Doubtless,
the Christians of Cilicia and Syria looked to Constantine in far off
Gaul as a model prince and emperor, and heard with joy of the
steady advance of Constantine’s ally, Licinius. The latter would come
in their eyes in the guise of a liberator, and prayers for his success
would be offered up in every Christian church of the persecuted
East. Maximin sought to repurchase their loyalty: it was too late. His
absurd pretext that his orders had been misunderstood by his
provincial governors would deceive no one. He had been the
shrewdest enemy with whom the Church had had to cope; his edict
of recantation was read with chilly suspicion or cold contempt, which
was changed into hymns of rejoicing when the Christians heard that
the tyrant had poisoned himself and died in agony, while his
conqueror, Licinius, had drowned the fallen Empress in the Orontes
and put to death her children, a boy of eight and a girl of seven.
Those who had suffered persecution for ten years may be pardoned
their exultation that there was no one left alive to perpetuate the
names of their persecutors.[72]
Throughout this time the West had escaped very lightly. Even
Maxentius had begun his reign by seeking to secure the good-will of
the Christians. Eusebius, indeed, makes the incredible statement[73]
that in order to please and flatter the Roman people he pretended to
embrace the Christian faith and “assumed the mask of piety.”
Probably all he did was to leave the Christians of Rome in peace.
The chair of St. Peter had remained empty for four years after the
death of Bishop Marcellinus. In 308 Marcellus was elected to fill it
and the Church was organised afresh. But it was rent with internal
dissensions. There was a large section which insisted that the
brethren who had been found weak during the recent persecution
should be received back into the fold without penance and reproach.
Marcellus stood out for discipline; the quarrel became so
exacerbated that Maxentius exiled the Bishop, who shortly
afterwards died. A priest named Eusebius was then chosen Pontiff,
but the schismatics elected a Pontiff of their own, Heraclius by name,
and the rival partisans quarrelled and fought in the streets.
Maxentius, with strict impartiality, exiled both. The record of this
schism is preserved in the curious epitaph composed by Pope
Damasus for the tomb of Eusebius: