oracle

Saturday, 29 April 2017

PL/SQL:Storing Data into Memory Variables.

By using pl/sql, we can get data from table and store them into variables( memory variables). After that we will use this data for further processing.

For Example: We want to retrive value from table employees and show first name and salary of employee whose employee id is 100.

Code:

declare
sal number;
name varchar2(30);
begin
select salary , first_name into sal,name from employees where employee_id=100;
dbms_output.put_line('Salary of Mr. '||name||' is '||sal);
end;

Result:
Salary of Mr. Steven is 24000

In above example sal and name are used as memory variables.

No comments:

Post a Comment