Opening Hours :7AM to 9PM
CREATE [OR REPLACE] PROCEDURE procedure_name [(parameter_name [IN | OUT | IN OUT] type [, ...])] {IS | AS} BEGIN < procedure_body > END procedure_name;Where,
CREATE OR REPLACE PROCEDURE greetings AS BEGIN dbms_output.put_line('Hello World!'); END; /When the above code is executed using the SQL prompt, it will produce the following result
EXECUTE greetings;The above call will display
BEGIN greetings; END; /The above call will display
DROP PROCEDURE procedure-name;You can drop the greetings procedure by using the following statement
DROP PROCEDURE greetings;
DECLARE a number; b number; c number; PROCEDURE findMin(x IN number, y IN number, z OUT number) IS BEGIN IF x < y THEN z:= x; ELSE z:= y; END IF; END; BEGIN a:= 23; b:= 45; findMin(a, b, c); dbms_output.put_line(' Minimum of (23, 45) : ' || c); END; /When the above code is executed at the SQL prompt, it produces the following result
DECLARE a number; PROCEDURE squareNum(x IN OUT number) IS BEGIN x := x * x; END; BEGIN a:= 23; squareNum(a); dbms_output.put_line(' Square of (23): ' || a); END; /When the above code is executed at the SQL prompt, it produces the following result
findMin(a, b, c, d);
findMin(x => a, y => b, z => c, m => d);
findMin(a, b, c, m => d); However, this is not legal: findMin(x => a, b, c, d);