SET ECHO ON SET SERVEROUTPUT ON -- -- plsql05.txt -- -- Simple PL/SQL demo -- This file shows how to create a procedure and the various ways to call it CREATE OR REPLACE PROCEDURE plsql05 (aName IN VARCHAR2 DEFAULT 'Bikle') AS anotherName VARCHAR2(99); BEGIN anotherName := aName; DBMS_OUTPUT.PUT_LINE ('Hello, this is Mr. ' || anotherName); END; / -- It is a good idea to look for errors after you create a procedure SHOW ERRORS -- This is an anonymous block to test the procedure DECLARE Name3 VARCHAR2(99) := 'Dan Bikle'; BEGIN plsql05(Name3); END; / -- This is an anonymous block to test the procedure BEGIN plsql05('Bill Clinton'); END; / -- The 'EXEC' keyword is a useful shortcut EXEC plsql05('Bill Clinton'); EXEC plsql05(); -- Demo of the DEFAULT keyword -- Try to fill and pass a sqlplus variable but it does not work. VAR Name4 VARCHAR2(99) SELECT 'X' INTO :Name4 FROM DUAL; EXEC plsql05(:Name4) -- End of demo