databases Online Quiz - 75
|Description: databases Online Quiz - 75|
|Number of Questions: 20|
|Created by: Aliensbrain Bot|
What code modificaiton should be made to run the below code ? begin dbms_scheduler.create_job ( job_name => 'RUN_SHELL1', schedule_name => 'DEMO_SCHEDULE', job_type => 'EXECUTABLES', job_action => '/home/test/run_script.sh', enabled => true, comments => 'Run shell-script' ); end; /
An existing sales catalog database structure exists on a system in your company. The company sells inventory from a single warehouse location that is across town from where the computer systems are located. The product table has been created with a nonclustered index, based on the product ID, which is also the primary key. Nonclustered indexes exist on the product category column and also the storage location column. Most of the reporting done is ordered by storage location. How would you change the existing index structure?
You are designing an application that will provide data entry clerks the capability of updating the data in several tables. You would like to ease entry and provide common input so the clerks do not need to enter data into all fields or enter redundant values. What types of technologies could you use to minimize the amount of input needed? (Select all that apply.)
You are the database developer for a leasing company. Your database includes a table that is defined as shown here: CREATE TABLE Lease (Id Int IDENTITY NOT NULL CONSTRAINT pk_lease_id PRIMARY KEY NONCLUSTERED, Lastname varchar(50) NOT NULL, FirstName varchar(50) NOT NULL, SSNo char(9) NOT NULL, Rating char(10) NULL, Limit money NULL) Each SSNo must be unique. You want the data to be physically stored in SSNo sequence. Which constraint should you add to the SSNo column on the Lease table?
You are preparing a new index on a table that has 1,500 rows. 10 rows are added to this table every day. The table already has a primary key, and the new index does not represent the order in which data in the table is to be stored. Updates to the table occur periodically but are infrequent. Which type of index would you create under this situation?
You have a database that contains several FOREIGN KEY and CHECK constraints. Users are having problems with data entry on the database because the data they are adding is constantly in violation of the CHECK constraints. Corporate policy regarding database design prevents you from modifying the current constraints, so you decide to implement your changes via a trigger. Which types of triggers would be best suited for this task?
Which statement is valid when removing procedures?
Which table should you query to determine when your procedure was last compiled?
Examine this procedure: CREATE OR REPLACE PROCEDURE ADD_PLAYER (V_ID IN NUMBER, V_LAST_NAME VARCHAR2) IS BEGIN INSERT INTO PLAYER (ID, LAST_NAME) VALUES (V_ID, V_LAST_NAME); COMMIT; END; This procedure must invoke the UPD_BAT_STAT procedure and pass a parameter. Which statement, when added to the above procedure will successfully invoke the UPD_BAT_STAT procedure?
To successfully invoke the UPD_BAT_STAT procedure and pass a parameter, you need to use the correct syntax. Let's go through each option to determine which statement should be added to the procedure:
Option A) EXECUTE UPD_BAT_STAT(V_ID) - This option is incorrect because EXECUTE is not a valid keyword to invoke a procedure in PL/SQL.
Option B) UPD_BAT_STAT(V_ID) - This option is correct because it uses the correct syntax to invoke the UPD_BAT_STAT procedure and pass the V_ID parameter.
Option C) RUN UPD_BAT_STAT(V_ID) - This option is incorrect because RUN is not a valid keyword to invoke a procedure in PL/SQL.
Option D) START UPD_BAT_STAT(V_ID) - This option is incorrect because START is not a valid keyword to invoke a procedure in PL/SQL.
The correct answer is Option B) UPD_BAT_STAT(V_ID). This option is correct because it uses the correct syntax to invoke the UPD_BAT_STAT procedure and pass the V_ID parameter.
Which type of argument passes a value from a procedure to the calling environment?
Examine this procedure: CREATE OR REPLACE PROCEDURE INSERT_TEAM (V_ID in NUMBER, V_CITY in VARCHAR2 DEFAULT ‘AUSTIN’, V_NAME in VARCHAR2) IS BEGIN INSERT INTO TEAM (id, city, name) VALUES (v_id, v_city, v_name); COMMIT; END Which two statements will successfully invoke this procedure in SQL *Plus?
Which two describe a stored procedure?
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) A stored procedure is typically written in SQL - This option is incorrect. While stored procedures can be written in SQL, they can also be written in other programming languages such as PL/SQL.
Option B) A stored procedure is a named PL/SQL block that can accept parameters - This option is correct. A stored procedure is a named PL/SQL block that can accept parameters. It allows you to encapsulate and execute a set of SQL statements and PL/SQL code.
Option C) A stored procedure is a type of PL/SQL subprogram that performs an action - This option is correct. A stored procedure is a type of PL/SQL subprogram that performs a specific action or set of actions.
Option D) A stored procedure has three parts: the specification, the body, and the exception handler part - This option is incorrect. While it is true that a stored procedure can have three parts (specification, body, and exception handler), it is not a mandatory requirement. A stored procedure can have only a body or a body with an exception handler.
Option E) The executable section of a stored procedure contains statements that assign values, control execution, and return values to the calling environment - This option is incorrect. While the executable section of a stored procedure can contain statements that assign values, control execution, and return values, it is not the only section of a stored procedure. A stored procedure can also have a declaration section where variables are declared and initialized.
The correct answer is B, C. These options correctly describe a stored procedure as a named PL/SQL block that can accept parameters and performs a specific action or set of actions.
Examine this code: CREATE OR REPLACE PROCEDURE insert_dept (p_location_id NUMBER) IS v_dept_id NUMBER(4); BEGIN INSERT INTO departments VALUES (5, ‘Education’, 150, p_location_id); SELECT department_id INTO v_dept_id FROM employees WHERE employee_id=99999; END insert_dept; / CREATE OR REPLACE PROCEDURE insert_location ( p_location_id NUMBER, p_city VARCHAR2) IS BEGIN INSERT INTO locations (location_id, city) VALUES (p_location_id, p_city); insert_dept(p_location_id); END insert_location; / You just created the departments, the locations, and the employees table. You did not insert any rows. Next you created both procedures. You now invoke the insert_location procedure using the following command: EXECUTE insert_location (19, ‘San Francisco’) What is the result in this EXECUTE command?
Local procedure A calls remote procedure B. Procedure B was compiled at 8 A.M. Procedure A was modified and recompiled at 9 A.M. Remote procedure B was later modified and recompiled at 11 A.M. The dependency mode is set to TIMESTAMP. What happens when procedure A is invoked at 1 P.M?
Examine this procedure: CREATE OR REPLACE PROCEDURE DELETE_PLAYER (V_ID IN NUMBER) IS BEGIN DELETE FROM PLAYER WHERE ID = V_ID; EXCEPTION WHEN STATS_EXITS_EXCEPTION THEN DBMS_OUTPUT.PUT_LINE (‘cannot delete this player, child records exist in PLAYER_BAT_STAT table’); END; What prevents this procedure from being created successfully?