Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can we call a procedure from a function?

Answers were Sorted based on User's Feedback



can we call a procedure from a function?..

Answer / karan

ya it is possible.we could call any sub program in another
sub program.

Is This Answer Correct ?    27 Yes 8 No

can we call a procedure from a function?..

Answer / vivek nagarajan

It is possible to call a function from a procedure.

Is This Answer Correct ?    17 Yes 3 No

can we call a procedure from a function?..

Answer / rat

Yes i am aggree with all three answers but there are
diffrent Scenarios.

you can not call a procedure in which dml ,ddl statement or
transaction controling statement is used.

you can all a procedure in which only select statement is
used.

please chekc if you dont have trust.

Is This Answer Correct ?    14 Yes 2 No

can we call a procedure from a function?..

Answer / yaswanth

Procedures cannot be called from functions where functions can be called from procedures.

Is This Answer Correct ?    7 Yes 1 No

can we call a procedure from a function?..

Answer / rakesh

Surely we can call.
if the procedure is using dml,then mark that procedure as
PRAGMA AUTONOMOUS_TRANSACTION.

then use that procedure in function.

Is This Answer Correct ?    5 Yes 2 No

can we call a procedure from a function?..

Answer / karthi

it is possible to call a function from Procedure but its
not possible to call a Procedure from a function..

Is This Answer Correct ?    7 Yes 6 No

can we call a procedure from a function?..

Answer / abhishekjaiswal

DECLARE
  FUNCTION my_func RETURN NUMBER IS
  BEGIN
    RETURN 2;
  END my_func;




  PROCEDURE my_proc IS
  BEGIN
    DBMS_OUTPUT.PUT_LINE(my_func + 1);
  END my_proc;




BEGIN  -- main
  my_proc;
END;    -- main
As shown above, with the function declared first you can call the function from the procedure. However, if you try something like the following (function declared before procedure, and function calls procedure):




DECLARE
  FUNCTION my_func RETURN NUMBER IS
  BEGIN
    my_proc;
    RETURN 2;
  END my_func;




  PROCEDURE my_proc IS
  BEGIN
    DBMS_OUTPUT.PUT_LINE('22');
  END my_proc;




BEGIN  -- main
  DBMS_OUTPUT.PUT_LINE(my_func);
END;    -- main
the compile will fail, because my_func cannot 'see' my_proc. To make it work you need to put in a 'prototype' declaration of my_proc, as follows:




DECLARE
  PROCEDURE my_proc;




  FUNCTION my_func RETURN NUMBER IS
  BEGIN
    my_proc;
    RETURN 2;
  END my_func;




  PROCEDURE my_proc IS
  BEGIN
    DBMS_OUTPUT.PUT_LINE('22');
  END my_proc;




BEGIN  -- main
  DBMS_OUTPUT.PUT_LINE(my_func);
END;    -- main

Is This Answer Correct ?    0 Yes 0 No

can we call a procedure from a function?..

Answer / rohini g

It is possible to call a function from Procedure but its
not possible to call a Procedure from a function..

Is This Answer Correct ?    0 Yes 1 No

can we call a procedure from a function?..

Answer / alok mbbs

I disagree with Karan and Vivek , i guess they are moving
away from the path .... answer is not upto the mark reason
being :::


Function cannot change the value in table.

Anyone disagree call me @

02267802321
i will explain in detail .....

Any appreciations call me for that

Is This Answer Correct ?    5 Yes 10 No

Post New Answer

More SQL PLSQL Interview Questions

Differentiate between pl/sql and sql?

0 Answers  


what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba

0 Answers  


What is a nested table in word?

0 Answers  


What is an Exception ? What are types of Exception ?

2 Answers  


what are the differences among these table level lock modes - IN SHARE MODE, IN SHARE UPDATE MODE, IN EXCLUSIVE MODE ?

3 Answers   HCL,


What is pl sql code?

0 Answers  


List the various privileges that a user can grant to another user?

0 Answers  


First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.

0 Answers   Prodapt,


What are the two types of periodical indexes?

0 Answers  


Describe sql comments?

0 Answers  


What is difference between ms sql and mysql?

0 Answers  


What is the need of a partition key?

0 Answers  


Categories