永发信息网

PLSQL题目,帮忙答下

答案:1  悬赏:80  手机版
解决时间 2021-06-01 22:23
  • 提问者网友:人傍凄凉立暮秋
  • 2021-06-01 15:09

1. It is good programming practice to create identifiers having the same name as column names. True or False?

a) 对

b) 错

2. Which SQL statements can be used directly in a PL/SQL block? (Choose two.)

a) GRANT EXECUTE ON ...

b) SELECt * INTO ...

c) REVOKE SELECT ON ...

d) UPDATE employees SET...

e) ALTER TABLE employees ...

3. When used in a PL/SQL block, which SQL statement must return exactly one row?

a) INSERT

b) UPDATE

c) SELECT

d) MERGE

e) DELETE

4. Which one of the following is NOT a valid guideline for retrieving data in PL/SQL?

a) Terminate the SQL statement with a semicolon (;)

b) Do NOT use a WHERe clause in SELECT statements.

c) Where possible, declare variables using the %TYPE attribute.

d) Specify the same number of variables in the INTO clause as database columns in the SELECT clause.

5. Which one of these SQL statements can be directly included in a PL/SQL executable block?

a) IF... THEN...;

b) INSERT INTO ...;

c) SELECT * FROM DUAL;

d) SHOW USER;

6. Look at this PL/SQL block:

DECLARE

v_count NUMBER;

BEGIN

SELECt COUNT(*) INTO v_count

FROM employees WHERe salary > 50000;

END;

No employees earn more than $50000. Which of the following statements are true? (Choose two). (选择所有正确答案)

a) The SELECt will return value 0 into V_COUNT.

b) The SELECT will fail because it does NOT return exactly one row.

c) The block will fail because variable V_SALARY was not declared.

d) The SELECT returns exactly one row.

e) The block will fail because no results are displayed to the user.

7. What will happen when the following block is executed?

DECLARE

v_last employees.last_name%TYPE;

v_first employees.first_name%TYPE;

v_salary employees.salary%TYPE;

BEGIN

SELECT first_name, last_name

INTO v_first, v_last, v_salary

FROM employees WHERe employee_id=100;

END;

a) The block will fail because the SELECt statement returns more than one row.

b) The block will fail because the SELECT is trying to read two columns into three PL/SQL variables.

c) The block will fail because V_LAST was declared before V_FIRST.

d) The block will execute successfully, and the V_SALARY variable will be set to NULL.

8. Does PL/SQL allow you to have a variable with the same name as a database column?

a) No

b) Yes

9. Examine the following code:

DECLARE

CURSOR country_curs IS

SELECT country_id, country_name

FROM wf_countries

ORDER BY country_name;

v_country country_curs%ROWTYPE;

BEGIN

OPEN country_curs;

LOOP

FETCH country_curs INTO v_country;

EXIT WHEN country_curs%NOTFOUND;

------- Line A

END LOOP;

CLOSE country_curs;

END;

You want to display the id and name of each FETCHed country. What would you code at Line A?

a) DBMS_OUTPUT.PUT_LINE(country_id || ' ' || country_name);

b) DBMS_OUTPUT.PUT_LINE(v_country(country_id) || ' ' || v_country(country_name));

c) DBMS_OUTPUT.PUT_LINE(country_curs.country_id || ' ' || country_curs.country_name);

d) DBMS_OUTPUT.PUT_LINE(v_country.country_id || ' ' || v_country.country_name);

10. You have declared the following cursor:

CURSOR country_curs IS

SELECt * FROM wf_countries

ORDER BY country_name;

There are over 200 rows in the WF_COUNTRIES table, but you want to fetch and display only the first 25 rows.

How would you exit from the FETCH loop?

a) EXIT WHEN country_curs%FOUND(25);

b) EXIT WHEN country_curs%ROWCOUNT > 25;

c) EXIT WHEN ROWCOUNT > 25;

d) WHEN country_curs > 25 THEN EXIT; END IF;

11. How must you reference one field which is part of a PL/SQL record?

a) field_name.record_name

b) record_name.field_name

c) record_name(field_name)

d) field_name OF record_name

12. Look at the following code:

DECLARE

CURSOR emp_cursor IS

SELECt employee_id, last_name, salary FROM employees;

v_empcurs emp_cursor%ROWTYPE;

What is the data type of V_EMPCURS?

a) Scalar

b) Record

c) Cursor

d) Row

13. Which of the following explicit cursor attributes evaluates to TRUE if the most recent FETCH returns a row?

a) %ISOPEN

b) %NOTFOUND

c) %FOUND

d) %ROWCOUNT

14 You can reference explicit cursor attributes directly in a SQL statement. True or False?

a) 对

b) 错

15. Look at these declarations:

DECLARE

CURSOR dept_loc_cursor IS

SELECt department_id, department_name, location_name

FROM departments d, locations l

WHERe d.location_id = l.location_id;

v_dept_loc dept_loc_cursor%ROWTYPE;

How many fields does V_DEPT_LOC contain?

a) Two, because the cursor joins two tables

b) Four

c)Three

16. Table candidates contains a CLOB column named job_appl, which already contains data values. Which of the following methods can be used to modify the CLOB column values? (Choose two.) (选择所有正确答案)

a) UPDATe candidates SET job_appl = 'new value';

b) Use DBMS_LOB.PUT in a PL/SQL block

c) UPDATE candidates SET substr(job_appl,500,9) = 'new value';

d) Use DBMS_LOB.WRITE in a PL/SQL block

17. Which of the following is NOT a benefit of using LOB datatypes?

a) They can store very large data values

b) They can store many different kinds of data, including text articles, movies, audio and photos

c) They are easier to program in PL/SQL than CHAR and VARCHAR2

d) LOB data can be stored inside or outside the database

18. Internal LOB values are stored inside the database and external LOB values are stored outside the database. True or False?

a) 对

b) 错

19. Converting a column from LONG RAW to BLOB can take a long time if the table contains millions of rows, because every one of the LONG RAW values must be copied and converted

a) 对

b) 错

20. Which of the following are NOT LOB datatypes? (Choose two.) (选择所有正确答案)

a) CLOB

b) JPEG (*)

c) BFILE

d) MP3 (*)

最佳答案
  • 五星知识达人网友:怙棘
  • 2021-06-01 16:33
1,选择b,不能创建相同的列名。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯