Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q81: Which of the following will declare a constant in PL/SQL?
- A: cost number := 100;
- B: PI CONSTANT NUMBER := 3.14;
- C: value integer := 20;
- D: fixed_value real := 30.5;
View Answer
B
Q82: What is the purpose of the SELECT INTO statement in PL/SQL?
- A: To insert values into a table
- B: To retrieve data from a table and assign to variables
- C: To update values in a table
- D: To delete rows from a table
View Answer
B
Q83: What exception is raised if the SELECT INTO statement returns more than one row?
- A: TOO_FEW_ROWS
- B: TOO_MANY_ROWS
- C: NO_ROWS_FOUND
- D: SYNTAX_ERROR
View Answer
B
Q84: In the SELECT INTO syntax, what condition must the WHERE clause satisfy?
- A: It must return all rows
- B: It must return exactly two rows
- C: It must return at most one row
- D: It must return more than one row
View Answer
C
Q85: What is the output of the statement SELECT 4982, sysdate INTO id, current_date FROM dual?
- A: 4982 and current date
- B: 1234 and current time
- C: 6789 and previous date
- D: None of the above
View Answer
A
Q86: What happens if a SELECT INTO query tries to fetch multiple rows without a WHERE clause?
- A: Returns all rows
- B: An exception is raised
- C: Returns the first row
- D: Only the last row is fetched
View Answer
B
Q87: What is the result of the PL/SQL block that selects empno, ename, hiredate INTO id, name, date_hire FROM emp WHERE empno=7369?
- A: Error due to multiple rows
- B: Values for empno 7369 are retrieved
- C: Values for empno 1234 are retrieved
- D: No data found
View Answer
B
Q88: What is the condition used to select employees with more than 5 years in an organization?
- A: deptno != 10
- B: hiredate >= 60 months
- C: months_between(sysdate, hiredate) >= 60
- D: hiredate = sysdate
View Answer
C
Q89: Which DML command is used to add rows to an existing table?
- A: INSERT
- B: UPDATE
- C: DELETE
- D: SELECT
View Answer
A
Q90: What is the output when the salary of employee no 7369 is increased by 25% of the maximum salary in the PL/SQL block?
- A: Old salary: 60000, New salary: 75000
- B: Old salary: 67589.6, New salary: 84487
- C: Old salary: 50000, New salary: 60000
- D: Old salary: 65000, New salary: 80000
View Answer
B