Question:- In PL/SQL, what is the Purpose of the DBMS_OUTPUT Package?
Answer:- The PL/SQL output is shown on the screen using the DMS_OUTPUT package. get_line, put_Line, new_line, and many more are found in DBMS_OUTPUT. The put_line procedure, which is a part of the DBMS_OUPUT package, is used to display the information in the line.
Question:- How can you Execute a Stored Procedure?
Answer:- There are two steps to execute a stored procedure: Use the EXECUTE keyword. The EXEC keyword can also be used. Call the name of the procedure from a PL/SQL block. Syntax EXECUTE procedure_name; Or Exec procedure_name;
Question:- What are the differences between ANY and ALL operators?
Answer:- ALL Operator: Value is compared to every value returned by the subquery using the ALL operator. • > ALL denotes greater than the maximum • < ALL denotes less than the minimum • <> ALL is the same as NOT IN condition ANY Operator: Value is compared to each value returned by the subquery using the ANY operator. SOME is a synonym for ANY operator. • ANY denotes something more than the bare minimum • < ANY denotes a value lower than the maximum • = ANY is the same as the IN operator
Question:- How to Create a Function?
Answer:- The syntax to create a CREATE function is below: CREATE function_name RETURN return_datatype {IS | AS} DECLARE VARIABLE DATATYPE; BEGIN function_body END function_name;
Question:- How can you Switch from an Init.ora File to Spfile?
Answer:- One can switch from Init.ora file to Spfile by creating a spfile from the pfile command.
Question:- What is a Subquery? What are Its Types?
Answer:- A subquery is a query within another query. The outer query is known as the main query and the inner query is called the subquery. A subquery is executed first, and the result of the subquery is passed to the main query. There are two types of subqueries: • Correlated • Non-correlated
Question:- How to find the number of rows in a DB2 table?
Answer:- To find the number of rows in a DB2 table, the user has to use SELECT COUNT (*) on the DB2 query.
Question:- How can the duplicate values be eliminated from DB2 SELECT?
Answer:- To eliminate the duplicate values from DB2 SELECT, the user has to use SELECT DISTINCT in the DB2 query.
Question:- What is Aggregate?
Answer:- ‘Aggregate’ functions are built-in mathematical tools that are used in the DB2 SELECT clause.
Question:- Is it possible using MAX on a CHAR column?
Answer:- Yes! It is possible using MAX on a CHAR column.
Question:- Why SELECT is not preferred in Embedded SQL programs?
Answer:- SELECT is not preferred in embedded SQL programs for three reasons. First, if the table structure is changed by the addition or deletion of a field and the program is modified, then using SELECT might retrieve the columns that the user may not use. This would lead to Input-Output overhead and the chances of index-only scan are also eliminated.
Question:- When is the LIKE statement used?
Answer:- The LIKE statement is used to conduct partial searches such as the search of employees by name. It is not necessary to indicate the complete name, partial string matches would do.
Question:- How is the value function used?
Answer:- We can perform two tasks using the ‘value’ function: • First, to avoid −ve SQLCODEs by handling NULLs and 0s in the computation • Second, to substitute numeric values for NULLs used in the computation
Question:- What are UNION and UNION ALL?
Answer:- Both UNION and UNION ALL are used to combine the results generated by multiple SELECT statements. • UNION is the function that eliminates duplicates in the table • UNION ALL retains the duplicates
