Basis PL-SQL
DECLARE
-- this section is optional
number1 NUMBER(2);
number2 number1%TYPE := 17; -- value default
text1 varchar2(12) := 'Hello world';
text2 DATE := SYSDATE; -- current date and time
BEGIN
-- this section is mandatory, must contain at least one executable statement
SELECT 1
INTO number1
FROM dual;
DBMS_OUTPUT.PUT_LINE('OK ' || number1 );
DBMS_OUTPUT.PUT_LINE(text1 || ' '||text2 );
EXCEPTION
-- this section is optional
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error Code is ' || TO_CHAR(SQLCODE ) );
DBMS_OUTPUT.PUT_LINE('Error Message is ' || SQLERRM );
END;