Professional Documents
Culture Documents
Oracle 11G PL SQL Programming 2Nd Edition Casteel Solutions Manual Full Chapter PDF
Oracle 11G PL SQL Programming 2Nd Edition Casteel Solutions Manual Full Chapter PDF
1. a
2. c
3. c
4. a
5. b
6. c
7. c
8. b
9. b
10. d
11. Functions are typically used to return one value via a RETURN statement. Functions
that follow certain restrictions can be used in both PL/SQL and SQL statements.
12. In a function, the RETURN statement returns a value to the calling environment. In a
procedure, a RETURN statement changes the flow of processing by exiting the procedure
at that point.
13. Formal parameters are listed in a procedure or function’s header and used to receive
values when the program unit is called. Actual parameters are the arguments used in the
statement that calls a program unit.
14. Passing by reference means the value in the actual parameter isn’t copied to the
formal parameter. A single copy of the value exists in the actual parameter, and a pointer
to it is held in the formal parameter. Passing by value means a copy of the value held in
the actual parameter is made and stored in the formal parameter.
15. Must be a stored database object (or in a stored package) and can use only IN
parameters. Formal parameter data types must use database data types. (No PL/SQL data
types, such as BOOLEAN, are permitted.) Return data types must be a database data type.
You must not issue transaction control statements to end the current transaction before
execution, and you can’t issue ALTER SESSION or ALTER SYSTEM commands.
1. d
2. a
3. c
4. c
5. b
Assignment 6-1
DECLARE
lv_amt_num NUMBER(8,2) := 9999.55;
BEGIN
DBMS_OUTPUT.PUT_LINE(dollar_fmt_sf(lv_amt_num));
END;
Assignment 6-2
Assignment 6-3
SELECT num_purch_sf(idShopper)
FROM bb_shopper
WHERE idShopper = 23;
Assignment 6-4
Assignment 6-5
DECLARE
lv_flag_txt VARCHAR2(12);
lv_id_num bb_basket.idbasket%TYPE := 3;
BEGIN
lv_flag_txt := ord_ship_sf(lv_id_num);
DBMS_OUTPUT.PUT_LINE('Basket ' || lv_id_num || ' ' || lv_flag_txt);
END;
Assignment 6-6
Assignment 6-7
SELECT tax_calc_sf(idbasket)
FROM bb_basket
WHERE idBasket = 4;
Assignment 6-8
DECLARE
lv_msg_txt VARCHAR2(15);
BEGIN
lv_msg_txt := ck_sale_sf(6,'10-JUN-12');
DBMS_OUTPUT.PUT_LINE(lv_msg_txt);
END;
DECLARE
lv_msg_txt VARCHAR2(15);
BEGIN
lv_msg_txt := ck_sale_sf(6,'19-JUN-12');
DBMS_OUTPUT.PUT_LINE(lv_msg_txt);
END;
Assignment 6-9
DECLARE
lv_pay_num NUMBER(8,2);
BEGIN
lv_pay_num := dd_mthpay_sf(240,12);
DBMS_OUTPUT.PUT_LINE(lv_pay_num);
END;
Assignment 6-10
CREATE OR REPLACE FUNCTION dd_projtot_sf
(p_id IN dd_project.idproj%TYPE)
RETURN NUMBER
IS
lv_amt_num NUMBER(9,2);
BEGIN
SELECT SUM(pledgeamt)
INTO lv_amt_num
FROM dd_pledge
WHERE idproj = p_id;
RETURN lv_amt_num;
END;
Assignment 6-11
Assignment 6-12
DECLARE
lv_pay1_dat DATE;
BEGIN
lv_pay1_dat := dd_paydate1_sf(102);
DBMS_OUTPUT.PUT_LINE(lv_pay1_dat);
END;
Assignment 6-13
DECLARE
lv_pay_dat DATE;
BEGIN
lv_pay_dat := dd_payend_sf(104);
DBMS_OUTPUT.PUT_LINE(lv_pay_dat);
END;
Case Projects
Case 6-1
UPDATE bb_basket
SET orderplaced = NULL,
Subtotal = NULL,
Tax = NULL,
Shipping = NULL,
Total = NULL
WHERE idBasket = 3;
SELECT idbasket, orderplaced, subtotal, tax, shipping, total
FROM bb_basket
WHERE idBasket = 3;
COMMIT;
CREATE OR REPLACE FUNCTION sub_calc_sf
(p_id NUMBER)
RETURN NUMBER
IS
lv_sub_num NUMBER(5,2) :=0;
BEGIN
SELECT SUM(quantity*price)
INTO lv_sub_num
FROM bb_basketitem
WHERE idBasket = p_id;
RETURN lv_sub_num;
END;
BEGIN
bask_calc_sp(3);
END;
Case 6-2
SELECT mov_info_sf(movie_id)
FROM mm_movie;
Another random document with
no related content on Scribd:
atmosphere of mystery; as it was this mysterious element that
complicated the situation, some explanation of it is necessary.
Sidi Mohammed Ben Ali Senussi, the founder of the Senussi
dervishes, while travelling, in 1830, from Morocco to Mecca,
divorced his wife, Menna, who had proved unfruitful, with the result
that, being wifeless, some natives of Biskra took compassion upon
him and presented him with an Arab slave girl. This woman is
supposed to have borne him a son—Sidi Ahmed el Biskri—who
played a somewhat prominent part later on in the history of the
Senussia. By another wife he had a son, Mohammed, whom he
declared on his deathbed to be the long-expected Mahdi.
These two half-brothers, Mohammed and Ahmed, are said to
have borne a striking resemblance to each other.
An old Senussi that I met in Dakhla, who professed to have seen
them both, said that not only were they of the same height and
figure, but that even their voices and manner were so much alike
that no one could distinguish between them.
There seems to be little doubt that when the Senussi Mahdi did
not wish to interview a visitor himself, he sent his double, Sidi
Ahmed, to do so instead. This deception was made easy by the fact
that the Senussi Mahdi, during the latter part of his life, was a veiled
prophet who concealed his face whenever he appeared in public by
covering his head with a shawl; it is reported that he never even
showed his face to his most intimate followers.
The interviews that he accorded to his visitors were few and
difficult to obtain. They were invariably short—the Mahdi himself
timing the interview with his watch—and the conversation, so far as
he was concerned, consisting of a few questions, followed, if
necessary, by a decision; his remarks being made in the low dreamy
voice of one who received his inspirations from on high—a method
of procedure that could hardly fail to impress, as it was evidently
intended to do, the credulous followers who came to see him with his
extreme sanctity and importance.
This Mahdi was reported to have died some years prior to my visit
to Dakhla, and although news of the happenings in the inaccessible
parts of North Africa is apt to be unreliable, there was little doubt that
he had.
The native version was that he had gone off into the desert and
disappeared; but probably he only followed the example of Sheykh
Shadhly, the founder of the great Shadhlia sect, and of several other
noted Moslem saints, and went off into the desert to die, when he felt
his end approaching.
There was, however, a pretty general feeling in the desert that the
last of him had not been seen—an impression that the Senussi
endeavoured to keep alive by the vague statement that he was
“staying with Allah,” and hints that he might at any moment reappear.
There was never much love lost between the Senussia and the
Turks. About a year before my visit to the desert, a Turkish official
had been sent down to Kufara Oasis, with orders to formally assert
the Sultan’s authority over the district, and to hoist the Turkish flag.
The fanatical inhabitants, however, had hauled down the flag, torn it
to ribbons, trampled it under foot, severely beaten the Turkish officer
and expelled him from the oasis, so the annexation of any part of the
Turkish Empire would have been a scheme well calculated to appeal
to the Senussi.
Ahmed el Biskri—the Mahdi’s double—was also reported to have
died. But nothing would have been easier than for the leading
Senussi sheykhs to find someone to personate their veiled prophet
on his return from “staying with Allah,” and to have used the
immense prestige that their puppet would have obtained amongst
their credulous followers to increase the influence of the sect, to
attract new followers and to work upon their fanaticism. The
“reappearance” of the Senussi Mahdi in this way is still a possibility
that is worth remembering.
News as to the doings of the leaders amongst the Senussia living
in the wilds of the Libyan Desert has always been very difficult to
obtain; but at that time they were reported in Dakhla to be
somewhere in the neighbourhood of Tibesti, which lay to the south-
west of Dakhla Oasis, in the direction of the road we had been
following, and it seemed likely, if they were really contemplating a
descent upon Egypt, that they might attempt, if water existed upon
this road, to make their way along it into Dakhla, and so on to the
Nile Valley.
With these considerations in view, I decided to make another trip
into the desert before returning to Egypt, to see if we could not
manage to reach the well, or oasis, to which the road ran, and to
ascertain if the road we had found was feasible for a large body of
men.
I sent a note to one of the British officials I had met in Cairo to let
the authorities have news of the rumoured invasion, for what it was
worth, and set to work to prepare for the journey.
I had not calculated on staying out in the desert so late in the
season, so my provisions had almost run out. The few tins of
preserved meat that remained had all suffered considerably from the
heat and were not fit for use. I had, however, still a few tins of
sardines, which in spite of their pronounced tinniness were still quite
edible, and a number of emergency rations, which had not suffered
in the least from the heat. These with a large skin of Arab flour and a
few pounds of mulberry jam, which Dahab made from some fruit that
the good people of Rashida sent me, provided ample food for
another journey.
After a few more days spent in feeding up the camels and
restoring them to a suitable condition for a long desert journey during
the hot weather, Qway thoroughly inspected the beasts, dug his
thumb into their quarters to test the consistency of their flesh,
expressed himself satisfied with the distended state of their tummies,
buttered the red camel again for mange, and then, as he declared
the beasts to be in first-rate condition, we prepared to start.
CHAPTER X
But it was clear that the camels were at their last gasp for want of
water, and the two weaker ones could hardly even stand. There was
only one way of getting those beasts back to Dakhla, and that was to
keep just enough water in the tanks to take the men back to our
rendezvous with Abd er Rahman, and to give the camels all the rest.
This had the double advantage of not only quenching their thirst, but
also of lightening considerably the loads that the poor brutes had to
carry; but it spelt disaster if Abd er Rahman failed to turn up.
In travelling in the desert during the hot weather, when the whole
caravan was on a limited water ration, I usually took the occasion of
watering the beasts to have a bath. The water was poured into a
folding canvas arrangement, in which—without using any soap—I
performed my ablutions, and the camels were allowed to drink out of
it afterwards. As a camel is not a fastidious beast in his diet, the
arrangement worked very well. But on this occasion I was deprived
of my wash, as, owing to the necessity of reducing the weight of the
baggage, I had been obliged to leave the bath behind in Mut.
The difficulty of keeping oneself properly clean on a limited water
supply constituted perhaps the greatest trial in a desert journey. The
baths I obtained when the camels drank were a great luxury, but my
washing in between their drinks was of the scantiest possible
description. The method that I found made the water go farthest was
to scrub myself clean with the moistened corner of a towel and rub
myself vigorously with the drier part of it afterwards. Sometimes the
supply was insufficient for even this economical method. I then
usually retired behind a rock, stripped and rolled in the sand like a
camel. This, though not so cleansing as the damp towel method,
was distinctly refreshing.
We got what rest we could during the early part of the evening,
and got off about two in the morning, marched throughout the night
until we halted for the midday rest. We were off again at five in the
evening and marched, with only one halt near midnight, to eat a
meal, till nine o’clock on the following morning, by which time we had
reached the top of the Bab es Sabah. We had then had enough of it
and camped till sunset, when we resumed our journey and marched
throughout the night till dawn.
The stars in the clear desert atmosphere shine with a brilliance
altogether unknown in our more northerly latitudes. The Milky Way
appears as a filmy cloud, and is so distinct that, when first I saw it in
the desert, I took it to be one. We were practically on the line of the
tropic of Cancer, and, in that southerly latitude, many stars appeared
that never show above the horizon in England, conspicuous among
them being that rather overrated constellation the Southern Cross.
Wasm, or Brand, of the Senussia.
Each Arab tribe has its own camel brand. The Wasm of the Senussi
Dervishes is the word “Allah” branded on the neck. (p. 24).