declare a number; b number; c number; begin a:=10; b:=20; c:=a+b; dbms_output.put_line(c); end;
2 - /* adding two numbers using runtime input */ declare a number; b number; c number; begin a:=&a; b:=&b; c:=a+b; dbms_output.put_line('the addition of two numbers :'||c); end;
3 - /* for character concantenation */ declare a varchar2(10); b varchar2(10); begin b:='&b'; a:='&a'; dbms_output.put_line(chr(10)||'this is my name '||a||b); end; 4 - /* simple select into statement */ declare a number; en varchar2(20); s number; begin select ename,sal into en,s from emp where empno=&a; dbms_output.put_line('the emp name is '||en||' and the salary is '||s); end; 5 - /* simple select into statement */ declare en varchar2(20); s number; a number; begin select ename,sal into en,s from emp where empno=&z;
dbms_output.put_line('the emp name is '||en||' and the salary is '||s); end;
6 - /* select all statement from a particular table; declare z lib.%rowtype; begin select * into * from lib where bno=&z; dbms_output.put_line('the book no is '||c||' and the book name is '||bt||' and the price '||pr); end;