Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- PL/SQL Block Procedure
- 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;
- /
- -- Standalone / Schema Level Procedure
- CREATE OR REPLACE 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;
- DECLARE
- a number;
- b number;
- c number;
- BEGIN
- a:= 23;
- b:= 45;
- findMin(a, b, c);
- dbms_output.put_line(' Minimum of (23, 45) : ' || c);
- END;
- /
- -- Standalone / Schema Level Function
- CREATE OR REPLACE FUNCTION total_produk
- RETURN number IS
- total number(2) := 0;
- BEGIN
- SELECT count(*) into total
- FROM produk;
- RETURN total;
- END;
- /
- DECLARE
- c number(2);
- BEGIN
- c := total_produk();
- dbms_output.put_line('Total no. of Customers: ' || c);
- END;
- /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement