How can we call stored procedures inside store procedures?



How can we call stored procedures inside store procedures?..

Answer / Rahul Tyagi

Calling a stored procedure within another stored procedure is possible in most database systems. The syntax for doing so varies between different database management systems (DBMS). In Oracle, for example, you can use the DBMS_SQL package to dynamically execute a stored procedure from within another stored procedure. Here's an example:

```sql
DECLARE
procedure_result NUMBER;
procedure_name VARCHAR2(100) := 'PROCEDURE_TO_CALL';
parameter1 VARCHAR2(50);
parameter2 NUMBER;
BEGIN
DBMS_SQL.PARSE(sql_handle => procedure_handle,
sql_statement => 'BEGIN ' || procedure_name || '(p1, p2); END;',
bind_array => NULL,
limit => 500,
warn_flag => DBMS_SQL.WARNINGS_ON);
DBMS_SQL.CALL_PROCEDURE(procedure_handle => procedure_handle,
arg1 => parameter1,
arg2 => parameter2);
DBMS_SQL.CLOSE(procedure_handle);
END;
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB Architecture Interview Questions

What is join dependency and inclusion dependency?

1 Answers  


Does storing of data in stored procedures increase the access time? Explain?

1 Answers  


Can we use commit inside the trigger? If not then how can we save the transaction made by the trigger?

1 Answers  


What is an Entity?

1 Answers  


What is Set-at-a-time or Set-oriented?

1 Answers  


What is the difference between a user defined function and a stored procedure?

1 Answers  


What is a view? How it is related to data independence?

1 Answers  


What is 4NF?

1 Answers  


What is the Disadvantage in File Processing System?

1 Answers  


Which is super key?

1 Answers  


Explain what are the restrictions that views have to follow? : sql server architect

1 Answers  


What is n tier architecture with example?

1 Answers  


Categories