PLSQL Homework 1
PLSQL Homework 1
HOMEWORK 1
17-05-2024
1 What is anonymous block in PLSQL?
ANS : An unnamed PL/SQL code block (code not stored in the database as a
procedure, function, or package) is known as an anonymous block.
It is a standalone block of code that can be executed directly in an Oracle database
without being stored in the database. These blocks are primarily used for
scripting, testing, or quick, ad-hoc tasks.
3. WHAT Is DBM_OUTPUT.PUT_LINE?
ANS : The DBMS_OUTPUT package enables you to send messages from stored
procedures, packages, and triggers.
The PUT and PUT_LINE procedures in this package enable you to place
information in a buffer that can be read by another trigger, procedure, or package.
4. What is varible?
ANS : Variables are used to store temporary data that can be manipulated and
used within the PL/SQL block during its execution. They can store various types of
data such as numbers, characters, dates, and more.
DECLARE
v_out NUMBER(10);
BEGIN
SELECT
10 * 30
INTO v_out
FROM
dual;
8. Write a code to multiply the numbber 10,20,40,60 and add 10,50 and
substract 5000-200?
>>DECLARE
V_OUT NUMBER (10);
V1_OUT NUMBER (10);
V2_OUT NUMBER (10);
BEGIN
SELECT 10*20*40*60 , 10+50,5000-200 INTO V_OUT ,V1_OUT,V2_OUT FROM
DUAL;
DBMS_OUTPUT.PUT_LINE ('MULTIPLICATION =' || V_OUT ||'____'|| 'ADDITION
='||V1_OUT||'____'||'SUBTRACTION ='||V2_OUT);
END;
9. Data type used in PLSQL?
---1. Scalar Data Types
---2. Composite Data Types
---3. Large Object (LOB) Data Types
---4. Reference Data Types
---5. User-Defined Data Types
10. Write a plsql block for the employee whose salary is 24000? output column
should be employee_id,first_name,last_name,salary?
11. write a plsql block for the employee whose last name is Mikkilineni?output
column should be employee_id,first_name,last_name,salary,job_id,email?
12. write a plsql block for the employee whose employee id is 131? output
column should be employee_id,first_name,last_name,salary,job_id,email?
>>DECLARE
BEGIN
END;