Mata kuliah : Pemrograman Basis Data II
Dosen : Titik Lusiani, M.Kom, OCA
Part 1
Oracle Developer dan Software
Develop menggunakan oracle seperti oracle forms dll.
PL/SQL : lebih mengarah ke
pembuatan program aplikasi
SQL : mengarah ke manipulasi
data/pengolahan data
Latihan 1
1.
D. Set serveroutput on
Mengaktifkan output/mengeksekusi suatu prosedur
2.
A. Show errors
Menampilkan kompilasi error
3.
D. Select * from order group by or having calc_comm (total ) > 500;
Menampilkan semua data pesanan yang memiliki prosedur
dengan total > 500
4.
D. Only the database administrator can recover this procedure using backup
Hanya administrator yang dapat merubah isi database
5.
D. Create or replace procedure
Digunakan untuk membuat prosedur dengan kondisi apabila
data baru maka akan langsung terbuat jika data telah ada maka akan ditindih/direplace
Part 2
Soal sertifikasi practice 2
1. The UPDATE_EMPLOYEE procedure contains an
algorithm that calculates an employee's commission multiple times throughout
the program. If a change is made to the algorithm, the change must be made
multiple times. How can this procedure be modified to simplify the code and
reduce duplicated code?
Jawab : C. Add a local subprogram
containing the algorithm.
Alasan : Menambahkan subprogram agar memudahkan dan tidak membuat ulang
programnya.
2. For which reason might you create a subprogram
within a procedure?
Jawab : D. to store a repeating block of code once without creating a
separate construct
Alasan : Untuk membuat suatu program hanya sekali tanpa harus membuat ulang
programnya
3. When invoking a procedure, you can specify the
arguments using the positional method by listing the values in the order of the
argument list. Which method would you use to list values in an arbitrary order?
Jawab : D. Named
Alasan : Suatu method yang digunakan untuk mengisi nilai yang dapat dijadikan perintah yang diubah-ubah
4. Which type of construct should you create to
solely perform an action without returning a value?
Jawab : C. procedure
Alasan : Karena procedure tidak mengembalikan nilai
5. Examine this procedure:
CREATE OR REPLACE PROCEDURE
find_seats_sold
(v_movie_id IN NUMBER
DEFAULT 34, v_theater_id IN NUMBER) IS
v_seats_sold
gross_receipt.seats_sold%TYPE;
BEGIN
SELECT seats_sold INTO
v_seats_sold FROM gross_receipt
WHERE movie_id = v_movie_id
AND theater_id = v_theater_id;
END;
Which command will
successfully invoke this procedure in SQL*Plus?
Jawab : C. EXECUTE find_seats_sold (v_theater_id => 500, v_movie_id
=> 34);
Alasan : Untuk menjalankan digunakan perintah execute jawaban a tidak
sesuai karena tidak ada parameter b syntax RUN bukan perintah menjalankan
program dan d kurang sesuai karena berupa inputan jawaban c paling sesuai
menurut syntax
6. Examine this procedure:
CREATE OR REPLACE PROCEDURE
find_seats_sold
(v_movie_id IN NUMBER) IS
v_seats_sold gross_receipt.seats_sold%TYPE;
BEGIN
SELECT seats_sold INTO
v_seats_sold
FROM gross_receipt
WHERE movie_id =
v_movie_id;
END;
Which command will
successfully invoke this procedure in SQL*Plus?
Jawab : C. EXECUTE find_seats_sold (34);
Alasan : Syntax yang paling sesuai dengan aturan sql * plus adalah jawaban
C
7. A stored function can be invoked in many
different ways. Which invocation example is NOT valid?
Jawab : D. executing the stored function within a CHECK constraint of a
table
Alasan : Karena constraint check hanya berupa kondisi pengecekan
8. Examine this function:
CREATE OR REPLACE FUNCTION
get_budget
(v_studio_id IN NUMBER)
RETURN number IS
v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget INTO
v_yearly_budget
FROM studio WHERE id = v_studio_id;
RETURN v_yearly_budget;
END;
Which set of statements will successfully invoke this function within
SQL*Plus?
Jawab : C. VARIABLE
g_yearly_budget NUMBER
EXECUTE :g_yearly_budget := GET_BUDGET(11);
Alasan : Jawaban C paling sesuai dengan variabel tanpa tanda :/input
parameter
9. Examine this function:
CREATE OR REPLACE FUNCTION
get_budget
(v_studio_id IN NUMBER,
v_max_budget IN NUMBER) RETURN number IS
v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget INTO
v_yearly_budget FROM studio
WHERE id = v_studio_id;
IF v_yearly_budget >
v_max_budget THEN
RETURN v_max_budget;
ELSE
RETURN v_yearly_budget;
END IF;
END;
Which set of statements
will successfully invoke this function within SQL*Plus?
Jawab : A. SELECT id, name, get_budget(id,200) FROM studio;
Alasan : perintah untuk menampilkan suatu function adalah dengan syntax
select
10. For which purpose are formal parameters used
when creating functions?
Jawab : B. passing values to the function
Alasan : Function dibuat ketika digunakan untuk mengisi suatu nilai
11. When creating a function in SQL*Plus, you
receive an error message stating that the function created with compilation
errors. What must you do to see the compilation errors?
Jawab : A. Issue the SHOW ERRORS command.
Alasan : Perintah show errors digunakan untuk menampilkan error
12. Examine this function:
CREATE OR REPLACE FUNCTION
set_budget
(v_studio_id IN NUMBER,
v_new_budget IN NUMBER) IS
BEGIN
UPDATE studio SET
yearly_budget = v_new_budget
WHERE id = v_studio_id;
IF SQL%FOUND THEN RETURN
TRUE;
ELSE RETURN FALSE;
END IF;
COMMIT;
END;
Which code must be added to
successfully compile this function?
Jawab : D. Add "RETURN BOOLEAN" immediately before the IS
keyword.
Alasan : untuk menambahkan function adalah dengan menuliskan add “RETURN
BOOLEAN” sebelum IS
13. Procedures and functions can be created and
stored in the database or in an Oracle Developer application. How is
performance improved when storing procedures and functions in the database?
Jawab : C. Network traffic is decreased by bundling commands.
Alasan : untuk meningkatkan performance ketika penyimpanan prosedur dan
function dalam database adalah dengan menurunkan lalulintas jaringan.
14. Examine this function:
CREATE OR REPLACE FUNCTION
set_budget
(v_studio_id IN NUMBER,
v_new_budget IN NUMBER)
RETURN BOOLEAN IS
BEGIN
UPDATE studio
SET yearly_budget =
v_new_budget
WHERE id = v_studio_id;
IF SQL%FOUND THEN
RETURN TRUE;
ELSE RETURN FALSE;
END IF;
COMMIT;
END;
Which code will
successfully invoke this function?
Jawab : D. DECLARE v_updated_flag BOOLEAN;
BEGIN
v_updated_flag := set_budget(11,500000000);
END;
Alasan : untuk menjalankan perintah function yang benar adalah dengan
memberi deklarasi kemudian nama function type data true/false boolean, kemudian
mengisi nama parameter dan function dengan 11,500000000.
15. Which two subprogram headers are correct?
(Choose two.)
Jawab : B. CREATE OR REPLACE PROCEDURE get_sal (v_sal IN number) IS
CREATE OR REPLACE FUNCTION calc_comm RETURN number (p_amnt IN number)
D. CREATE OR REPLACE FUNCTION calc_comm (p_amnt IN number) RETURN number
Alasan :
jawaban a salah karena salah penempatan is, c salah karena function akan
mengembalikan type data bukan parameter, jawaban d seharusnya hanya ada
parameter saja.
Part 3
Soal sertifikasi practice 2
1. Procedures and functions are very similar. For
which reason would you choose a function over a procedure?
Jawab : B. A function can be used in a SQL statement.
Alasan : karena function dapat digunakan dalam perintah SQL
2. The GET_BUDGET function is no longer needed
and should be removed. Which command will successfully remove this function
from the database?
Jawab : C. DROP FUNCTION get_budget;
Alasan : untuk menghapus function get_budget maka digunakan drop function
3. Which code successfully calculates commission
returning it to the calling environment?
Jawab : D. CREATE OR REPLACE FUNCTION calc_comm (v_emp_id IN NUMBER) RETURN
number IS
v_total NUMBER;
BEGIN
SELECT SUM(ord.total) INTO
v_total
FROM ord,customer
WHERE ord.custid =
customer.custid
AND customer.repid =
v_emp_id;
RETURN (v_total * .20);
END;
Alasan : Jawaban A dan B salah karena tidak mengembalikan nilai sedangkan C
syntax tidak lengkap
4. Examine this function:
CREATE OR REPLACE FUNCTION
get_budget
(v_studio_id IN NUMBER,
v_max_budget IN NUMBER) RETURN number IS
v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget INTO
v_yearly_budget FROM studio
WHERE id = v_studio_id;
IF v_yearly_budget >
v_max_budget THEN RETURN v_max_budget;
ELSE RETURN
v_yearly_budget;
END IF;
END;
Which set of statements
will successfully invoke this function within SQL*Plus?
Jawab : A. SELECT id, name, get_budget(id,200) FROM studio;
Alasan : untuk memanggil function digunakan select kemudian nama function
5. A stored function can be invoked in many
different ways. Which invocation example is NOT valid?
Jawab : D. executing the stored function within the DEFAULT clause of the
CREATE TABLE
Alasan : Karena function tidak dapat membuat tabel
6. You have just created a PL/SQL user-defined
function called CALC_COMM. Which statement will successfully test it?
Jawab : D. SELECT * FROM ord GROUP BY ordid HAVING calc_comm(total) >
5000;
Alasan : Memanggil function dengan kondisi having....function
7. How do functions simplify maintainability?
Jawab : A. by limiting changes to logic to one location
Alasan : memperbaiki satu lokasi function untuk pemanggilan satu function
8. Which two statements are true? (Choose two.)
Jawab : A. function must return a value.
D. A function can be invoked from within a
PL/SQL expression.
Alasan : karena pernyataan yang benar adalah
function pasti mengembalikan nilai dan function dapat digunakan dalam PL/SQL
9. Examine this statement:
SELECT id,
theater_pck.get_budget(id)
FROM studio;
What must be true about the
GET_BUDGET function for this statement to be successful?
Jawab : B. It must not modify the database.
Alasan : tidak bisa memodifikasi database karena select untuk menampilkan
10. Examine this function:
CREATE OR REPLACE FUNCTION
get_budget
RETURN number IS
v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget INTO
v_yearly_budget
FROM studio WHERE id =
v_studio_id;
RETURN v_yearly_budget;
END;
What additional code is needed to
compile this function successfully?
Jawab : D. Add "(v_studio_id IN
NUMBER)" right before the RETURN statement of the header.
Alasan : Karena yang dibutuhkan adalah
Menambah variable sebelum return
11. Which subprogram type can be invoked from
within a SQL statement?
Jawab : A. Function
Alasan :
subprogram dapat digunakan dalam SQL dengan function
12. Examine this function:
CREATE OR REPLACE FUNCTION
get_budget
(v_studio_id IN NUMBER)
RETURN number IS
v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget INTO
v_yearly_budget
FROM studio WHERE id =
v_studio_id;
END;
To execute this function
successfully, what additional code must be added to the executable section?
Jawab : D. RETURN v_yearly_budget;
Alasan : Untuk eksekusi function agar sukses
ditambahkan return v_yearly_budget
13. While creating a package, you placed the
function name in the specification and the body. Which type of construct have
you created?
Jawab : A. Public
Alasan : agar function dapat dibaca seluruh package maka digunakan public
14. Examine this code:
CREATE OR REPLACE PACKAGE
prod_pack IS
g_tax_rate NUMBER := .08;
END prod_pack;
Which statement about this
code is true?
Jawab : A.This package specification can exist without a body.
Alasan : karena code ini dapat berjalan tanpa body
15. Examine this package specification:
CREATE OR REPLACE PACKAGE
theater_package IS
PROCEDURE find_cpt
(v_movie_id IN NUMBER,
v_cost_per_ticket IN OUT NUMBER);
PROCEDURE update_theater
(v_name IN VARCHAR2);
PROCEDURE find_seats_sold
(v_movie_id IN NUMBER
DEFAULT 34, v_theater_id IN NUMBER);
PROCEDURE add_theater;
END theater_package;
Which statement about the
procedures in this specification is true?
Jawab : A. They are public procedures.
Alasan : Karena
syntax diatas termasuk dalam public procedures
Part 4
Soal sertifikasi practice 1
1.
Your stored procedure, GET_BUDGET, has a logic problem
and must be modified. The script that contains the procedure code has been
misplaced. Which data dictionary view can you query to capture the source code
for this procedure?
Jawab : D. USER_SOURCE
Alasan : untuk melihat data dari prosedur
adalah menggunakan user_procedures
2.
The database administrator has informed you that the
CREATE PROCEDURE privilege has been granted to your account. Which objects can
you now create?
Jawab : B. procedures, functions, and packages
Alasan : perintah yang diinginkan adalah
membuat prosedur dan memberihak pada akun tertentu
3.
Which data dictionary table can you query to determine
all stand-alone procedures that reference the THEATER_PCK package?
Jawab : D. USER_DEPENDENCIES
Alasan : untuk megatur semua prosedur maka
digunakan perintah user_dependencies
4.
Which data dictionary view can you query to examine all
the dependencies between the objects that you own?
Jawab : C. USER_DEPENDENCIES
Alasan : data dependencies dapat dilihat
melalui user_dependencies
5.
Due to a change to a particular table, you are concerned
with the number of stored procedures and functions that may have been affected.
Which table can you query to check the status of each subprogram and determine
which procedures and functions must be recompiled?
Jawab : C. USER_OBJECTS
Alasan : user_objects dapat digunakan untuk
melihat status/function valid/tidak
6.
You have lost the script file that contains the source
code for the THEATER_PCK package. Which command will produce the source code
stored in the database?
Jawab : A. SELECT text FROM user_source WHERE
name = 'THEATER_PCK';
Alasan : untuk melihat data dari theater_pck
bisa dari user_source
7.
Which view can you query to determine the validity of a
particular procedure?
Jawab : C. USER_OBJECTS
Alasan : melihat valid/tidak dan dapat memodifikasi isi data
8.
Which data dictionary view must you query to determine
when a particular procedure or function was created?
Jawab : C. USER_OBJECTS
Alasan : melihat valid/tidak, memodifikasi isi
data dan verifikasi
9.
All users in the HR_EMP role have UPDATE privileges on
the EMPLOYEE table. You create the UPDATE_EMPLOYEE procedure. HR_EMP users
should only be able to update the EMPLOYEE table using this procedure. Which
two statements should you execute? (Choose two.)
9.Jawab : C. REVOKE UPDATE ON employee FROM
hr_emp;
E. GRANT EXECUTE ON update_employee TO hr_emp;
Alasan : untuk menggunakan update perintahnya
adalah Revoke, Grant sebagai hak akses
10.
Which statement concerning the use of a procedure is
true?
Jawab : C. A user needs only the privilege to
execute the procedure and does not need privileges on the underlying tables.
Alasan : pernyataan yang sesuai adalah user
hanya perlu satu privillage untuk mengeksekusi prosedur
11.
Examine this procedure:
CREATE OR REPLACE PROCEDURE update_theater
(v_name IN VARCHAR2) IS BEGIN
DELETE theater WHERE id = 34;
END update_theater;
This procedure is owned by PROD. The user
JSMITH must execute this procedure. Which command(s) must PROD execute to grant
the necessary privileges to JSMITH?
Jawab : A. GRANT EXECUTE ON update_theater TO
jsmith;
Alasan : jsmith memiliki hak akses sebagai
user
12.
You have just successfully dropped the CALC_COMM
procedure and deleted the script file containing the source code. Which command
can you execute to recover this procedure?
Jawab : D. Only the database administrator can
recover this procedure using backups.
Alasan : hanya admin yang dapat melakukan
perubahan data
13.
Examine this procedure:
CREATE OR REPLACE PROCEDURE remove_department
(v_deptno IN NUMBER) IS
BEGIN
DELETE dept WHERE deptno = v_deptno;
END;
After executing this procedure, you receive
this message:
ORA-02292: integrity constraint
(SCOTT.FK_DEPTNO) violated - child record found
What must be added to the procedure to handle
this error?
Jawab : D. Declare a new exception and
associate it with error code -2292. Create an exception section, and add code
to handle this non-predefined exception that you just declared.
Alasan : untuk mengatasi error maka butuh
exception section
14.
Examine this procedure:
CREATE OR REPLACE PROCEDURE FIND_ORDERS
(v_total IN sales_order.total%TYPE) IS
CURSOR c1 IS SELECT order_id FROM sales_order
WHERE total > v_total;
BEGIN
FOR sales_order_rec in c1 LOOP
--process the row
END LOOP;
END;
This procedure returns all orders with a total
greater than an amount that is passed in the V_TOTAL parameter. Occasionally, a
user might want to process all orders regardless of the total amount. They
could do this by passing 0 in the V_TOTAL parameter, however, they would prefer
not to pass anything. Which change can you make to the procedure to allow a
user to process all orders in the SALES_ORDER table without having to pass a 0
total amount?
Jawab : D. Use (v_total IN
sales_order.total%TYPE DEFAULT 0) as the parameter definition.
Alasan : parameter jika kosong disi 0
(default)
15.
Examine this procedure:
CREATE PROCEDURE update_theater IS
BEGIN
UPDATE theater SET name = v_name
WHERE id = 34;
END;
Because a value for the new theater name must be
passed to this procedure upon invocation, you decide to create a parameter
called V_NAME to hold the value. To be successful, which additional change must
you make to this procedure?
Jawab : C. Add (v_name IN VARCHAR2)
immediately before the IS keyword.
Alasan : melihat semua data add
Part 5
Soal Latihan
1.
Apa itu user_source dan user_object?
User_source : melihat source code dari
prosedur
User_object : melihat status dari
function/prosedur apakah valid/tidak dan kapan memodifikasi
2.
Apa itu privillage?
Privillage adalah hak akses yang diberikan
pada user
3.
Jelaskan arti dari user_dependencies!
User_ dependencies : melihat data yang
berkaitan dengan object yang saling terhubung
4.
Jelaskan perintah dari grant execute on update_theater to
jsmith;
Adalah perintah untuk memberi hak akses untuk
mengedit update_theater untuk user jsmith
Part 6
Cursor
Cursor adalah kumpulan set yang dimasukkan
kedalam form atau variabel data yang dimasukkan secara indeks dalam himpunan
Cursor digunakan untuk menampilkan data dalam
database
Type data dalam cursor biasanya mereference
kedalam database dengan syntax %type
Macam-macam SQL cursor attribut
-
SQL%Rowcount : sejumlah row yang ada
-
SQL%found : melihat data ketemu/tidak
-
SQL%notfound : data tidak ditemukan
-
SQL%is open : membuka data/database dan cursor
Soal latihan
1. Apa itu cursor?
2. Jelaskan tentang sql cursor attribut!
3. Jelaskan perintah berikut : months_between
(sysdate, vhire_date)/12>5
4. Jelaskan : v_employee_id
employees.employee_id%type :=176;
Jawab :
1. Cursor adalah kumpulan set yang dimasukkan
kedalam form atau variabel data yang dimasukkan secara indeks dalam himpunan
2. SQL cursor attribut :
SQL%Rowcount : sejumlah row yang ada
SQL%found : melihat data ketemu/tidak
SQL%notfound : data tidak ditemukan
SQL%is open : membuka data/database dan cursor
3. Menghitung selisih bulan antara tanggal hari ini
dengan tanggal masuk/12 apakah>5
4. Variabel penampung v_employee_id menjadi tabel
employee.id%type data sesuai database dan diisi 176
Part 7
Soal
sertifikasi practice 1
16. Examine this procedure:
CREATE
PROCEDURE add_theater IS
BEGIN
INSERT
INTO theater
VALUES
(35, 'Riverplace Theatre', '1222 River Drive, Austin, Tx.');
END;
This procedure already exists in the database. You have made a change to
the code and want to recreate the procedure. Which command must you now use to
prevent an error?
Jawab : D. UPDATE PROCEDURE WITH
Alasan : Perintah tersebut digunakan apabila
ada data yang sama/baru
17. Examine this procedure:
CREATE
OR REPLACE PROCEDURE find_cpt
(v_movie_id
{argument mode} NUMBER, v_cost_per_ticket {argument
mode}
NUMBER) IS
BEGIN
IF
v_cost_per_ticket > 8.50 THEN
SELECT
cost_per_ticket INTO v_cost_per_ticket
FROM
gross_receipt WHERE movie_id = v_movie_id;
END
IF;
END;
Which
argument mode should be used for V_MOVIE_ID?
Jawab : A. IN
Alasan : digunakan untuk memasukkan data ke
dalam variabel
18. Which statement about declaring arguments
for procedures is true?
Jawab : D. Formal arguments allow you to
transfer values to and from the calling environment.
Alasan : untuk mentransfer suatu nilai formal
argument diperbolehkan.
19. You execute this code:
CREATE OR REPLACE PROCEDURE find_seats_sold (v_movie_id IN NUMBER DEFAULT
34) IS
v_seats_sold
gross_receipt.seats_sold%TYPE;
BEGIN
null;
END;
Which
statement is true?
Jawab : A. The statement compiles, and the
procedure is created.
Alasan : eksekusi suksea dan prosedur terbuat
sesuai dengan ketentuan statement SQL
20. Which statement about error propagation is
true?
Jawab : D. When an exception is raised in a
called procedure, control goes to the exception section of that block.
Alasan : karena error propagation ada dalam
prosedur
21. Which statement about the use of the
DEFAULT clause in the declaration of a formal parameter is true?
Jawab : D. IN OUT parameters cannot be
initialized with a default value.
Alasan : pernyataan yang benar adalah
parameter in out tidak dapat diinisialisasikan dalam nilai default
22. Examine this procedure:
CREATE
OR REPLACE PROCEDURE find_cpt
(v_movie_id IN NUMBER, v_cost_per_ticket IN OUT NUMBER DEFAULT 0) IS
BEGIN
IF
v_cost_per_ticket > 8.50 THEN
SELECT
cost_per_ticket INTO v_cost_per_ticket
FROM
gross_receipt WHERE movie_id = v_movie_id;
END
IF;
END;
Why
does this statement fail when executed?
Jawab : E. The declaration of
V_COST_PER_TICKET cannot have a DEFAULT value.
Alasan : karena deklarasi nama prosedur tidak
dapat dijadikan nilai default
23. Which statement about formal parameters is
true?
Jawab : B. An IN OUT formal parameter does not
require a value before returning to the calling environment.
Alasan : karena in out digunakan sebagai
parameter untuk memberikan nilai pada PL/SQL block
24. Examine this procedure:
CREATE
OR REPLACE PROCEDURE find_seats_sold
(v_movie_id
IN NUMBER DEFAULT 34, v_theater_id IN NUMBER) IS
v_seats_sold
gross_receipt.seats_sold%TYPE;
BEGIN
SELECT
seats_sold INTO v_seats_sold
FROM
gross_receipt
WHERE
movie_id = v_movie_id AND theater_id = v_theater_id;
END;
Which
command will successfully invoke this procedure in SQL*Plus?
Jawab : C. EXECUTE find_seats_sold
(v_theater_id => 500);
Alasan : A dan D salah karena RUN bukan
perintah untuk menjalankan prosedur, B kurang tepat karena Nilai v_movie_id telah
didefault 34
25. When creating the ADD_PROD procedure in
SQL*Plus, you receive this message:
Warning:
Procedure created with compilation errors.
What
was saved to the data dictionary?
Jawab : C. source code and compilation errors
Alasan : karena data dictionary menyimpan
keduanya
26. Examine this procedure:
CREATE
OR REPLACE PROCEDURE find_seats_sold
(v_movie_id
IN NUMBER) IS
v_seats_sold
gross_receipt.seats_sold%TYPE;
BEGIN
SELECT
seats_sold INTO v_seats_sold FROM gross_receipt
WHERE
movie_id = v_movie_id;
END;
The value of V_SEATS_SOLD must be returned to the calling environment.
Which change should you make to the code?
Jawab : A. Declare V_SEATS_SOLD as an OUT
argument.
Alasan : karena V_SEATS_SOLD mengeluarkan
sebuah nilai
27. Which statement about declaring parameters
is true?
Jawab : A. Only data type is required.
Alasan : karena hanya dengan nama dan type
data saja deklarasi sudah dapat digunakan
28. Examine this procedure:
CREATE
OR REPLACE PROCEDURE find_cpt
(v_movie_id {argument mode} NUMBER, v_cost_per_ticket {argument mode}
NUMBER) IS
BEGIN
IF
v_cost_per_ticket > 8.50 THEN
SELECT
cost_per_ticket INTO v_cost_per_ticket
FROM
gross_receipt
WHERE
movie_id = v_movie_id;
END
IF;
END;
Which
mode should be used for V_COST_PER_TICKET?
Jawab : D. IN OUT
Alasan : in perlu inputan nilai kemudian
ditampilkan
Out sebagai nilai pembanding/mengeluarkan
sebuah nilai
29. The CALC_COMM procedure is no longer
needed and should be removed. Which command will successfully remove this
procedure from the database?
Jawab : C. DROP PROCEDURE calc_comm;
Alasan : untuk menghapus digunakan drop
prosedur kemudian nama prosedur
30. Examine this procedure:
CREATE
PROCEDURE add_theater IS
BEGIN
INSERT
INTO theater
VALUES
(35, 'Riverplace Theatre', '1222 River Drive, Austin, Tx.');
END;
Which
three statements about this procedure are true? (Choose three.)
Jswsb : A. The ADD_THEATER procedure is
written in SQL.
B. The ADD_THEATER procedure can be shared by
multiple programs.
C. The ADD_THEATER procedure will be
stored in the database as a schema object.
Alasan : prosedur ditulis dalam analisis,
dapat dibagi dalam multiple program dan setiap user punya schema objest
Tidak ada komentar:
Posting Komentar