Which two program declarations are correct for a stored program unit? (Choose two)
A.
CREATE OR REPLACE FUNCTION tax_amt
(p_id NUMBER)
RETURN NUMBER
B.
CREATE OR REPLACE PROCEDURE tax_amt
(p_id NUMBER)
RETURN NUMBER
C.
CREATE OR REPLACE PROCEDURE tax_amt
(p_id NUMBER, p_amount OUT NUMBER)
D.
CREATE OR REPLACE FUNCTION tax_amt
(p_id NUMBER)
RETURN NUMBER(10,2)
E.
CREATE OR REPLACE PROCEDURE tax_amt
(p_id NUMBER, p_amount OUT NUMBER(10, 2))
Explanation:
A: This is the correct syntax for creating a Function. The syntax for creating a function is similar to that of creating a procedure with the addition of a RETURN
statement. The following is the syntax for CREATE FUNCTION:
CREATE [OR REPLACE] FUNCTION [(parameter [mode1]
datatype1,
parameter2 [mode2] datatype2 …)]
RETURN datatype
IS | AS
PL/SQL BLOCK;
C: This is the correct syntax for creating a Procedure.The syntax for creating a procedure
is:
CREATE [OR REPLACE] PROCEDURE
[parameter1 [mode1] datatype1,
parameter2 [mode2] datatype2,
. . .)]
IS | AS
. . .
BEGIN
. . .
EXCEPTION
END ;
Incorrect Answers
B: This is incorrect syntax for a Procedure. Functions have a RETURN Clause, Procedures do not.
D: When you define the data type, the length of the data type is not allowed in the parameter list. If you specify the length of a formal parameter, Oracle issues an error at
compilation time.
E: The length of the data type is not allowed in the parameter list for functions or procedures.
Here are some links to internet sites that we link to for the reason that we think they may be really worth visiting.
always a big fan of linking to bloggers that I love but really don’t get a good deal of link like from