This is sample code 1:
declare
test_message varchar2(30):='Hello World';
message varchar2(20);
begin
message:='This is Arvind';
DBMS_OUTPUT.PUT_LINE(test_message || ' ' || message);
END;
/
This is sample code 2:
declare
num1 number:='10';
num2 number:='3';
num number;
num3 number;
begin
num:= num1+ num2;
DBMS_OUTPUT.PUT_LINE('This is num1: '||num1 || ', This is num2: ' || num2);
DBMS_OUTPUT.PUT_LINE('This is the ouput num1+num2: ' || num);
num3:=num+37;
DBMS_OUTPUT.PUT_LINE('This is the ouput num3: ' || num3);
END;
/
Sample code 3:
declare
A1 number := &A1;
B1 number := &B1;
C1 number;
ERR exception;
begin
C1 :=A1 + B1;
if C1 <= 5 then
raise ERR;
else
DBMS_OUTPUT.PUT_LINE (' Value of C1 is '||C1||'' );
end if;
EXCEPTION
WHEN ERR THEN
DBMS_OUTPUT.PUT_LINE (' Value of C1 is less than 5' );
end;
No comments:
Post a Comment