Go to “MS-DOS.”
Change directory to the iself directory and login to “sqlplus” as
"iself/schooling."
>> cd ..\iself
>>sqlplus iself/schooling
Write a
PL/SQL block to use only the "body" section with PL/SQL statement.
>> begin
null;
end;
/
Use the slash (/) to compile and run the block.
Add the "declaration" section with no variables. Then compile and run the
block.
>> declare
-- no variable
begin
null;
end;
/
Use the “Set serveroutput on” to display the buffer used by dbms_output.
>> set serveroutput on
Write a PL/SQL block, to output the "Hello iselfschooling" message.
>> begin
dbms_output.put_line('Hello
iselfschooling');
end;
/
describe the department table.
>> desc dept
Write a PL/SQL block, to declare a department name variable with the same
datatype of the department name.
Then assign "HR" to the variable and output the variable.
>> declare
v_dname varchar2(14);
begin
v_dname := 'HR';
dbms_output.put_line(v_dname);
end;
/
Save the PL/SQL block as “test_myblock.”
Then go to notepad and open the PL/sql block from the “iself” directory.
Use the %type keyword, to declare a variable as the same datatype and size
of the department name column of the dept table.
Then save the file.
Go to “SQLPLUS.”
Get the file.
And run it.
The same output!