Is the below query allowed?Select sal, ename Into x From emp Where ename = 'KING' (Where x is a record of Number(4) and Char(15));
-
Yes
-
No
-
Not in Oracle
-
None of the above
The SELECT-INTO statement in PL/SQL can fetch values into a record variable. When x is a record with components matching the selected columns (sal as NUMBER(4) and ename as CHAR(15)), this is perfectly valid syntax. The query will populate the record fields with the retrieved values.
To answer this question, we need to understand the syntax and rules for the SELECT statement in Oracle.
The SELECT statement is used to query data from a database table. It allows you to specify the columns you want to retrieve, the table you want to query from, and any conditions for filtering the results.
In the given query, the SELECT statement is used to retrieve the "sal" and "ename" columns from the "emp" table. The INTO clause is used to specify that the result of the query should be stored in the variables "x.sal" and "x.ename". The WHERE clause is used to filter the rows based on the condition "ename = 'KING'".
The syntax of the query is correct, and it is allowed in Oracle. Therefore, the correct answer is A) Yes.