Basic Oracle Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Call a Stored Function with Parameters?
Answer:
You can define a function that takes parameters, provide values to those parameters when calling the function. Here is a good example of a function with a parameter:
SQL> CREATE OR REPLACE FUNCTION GET_DOUBLE(X NUMBER)
2 RETURN NUMBER AS
3 BEGIN
4 RETURN X * 2;
5 END;
6 /
Function created.
SQL> SELECT GET_DOUBLE(36) FROM DUAL;
GET_DOUBLE(36)
--------------
72
SQL> CREATE OR REPLACE FUNCTION GET_DOUBLE(X NUMBER)
2 RETURN NUMBER AS
3 BEGIN
4 RETURN X * 2;
5 END;
6 /
Function created.
SQL> SELECT GET_DOUBLE(36) FROM DUAL;
GET_DOUBLE(36)
--------------
72
Download Oracle Database Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Drop a Stored Function? | How To Define an Oracle Sub Procedure? |