gpinfotech
asked on
insert data into multiple tables using single stored procedure
Hi All,
I need to build a stored procedure to insert data into different tables of a database.
Here each table is different from other in the concept of number of columns and data types.
Here i want to put different insertion statements in one single stored procedure.
so just by executing this stored procedure once, i want to insert data into one table based on the given table_name as input parameter to the store procedure.
Is this possible to develop a stored procedure like this?.
If possible ,Pls give me the syntax of the SP.
Thanks in Advance
I need to build a stored procedure to insert data into different tables of a database.
Here each table is different from other in the concept of number of columns and data types.
Here i want to put different insertion statements in one single stored procedure.
so just by executing this stored procedure once, i want to insert data into one table based on the given table_name as input parameter to the store procedure.
Is this possible to develop a stored procedure like this?.
If possible ,Pls give me the syntax of the SP.
Thanks in Advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
But i need to pass each row as input parameter.
How to pass values as input parameters to different input statements for different tables.
insert into table1(....)values(val1,va l2)
insert into table2(-,-) values(valx,valy)
How to pass values as input parameters to different input statements for different tables.
insert into table1(....)values(val1,va
insert into table2(-,-) values(valx,valy)
ASKER
Hello ivostoykov,
create procedure pname
as
begin
inseret into table1(-,-) values(-,-)
insert into table2(-,-) values(-,-)
insert into table3(-,-) values(-,-)
------lke this stored procedures contains different insertion statements.
by executing SP i want to run only one insert statement out of many.And i want to pass values as input parameters.So based on the input parameters ,particular input statement should execute.
create procedure pname
as
begin
inseret into table1(-,-) values(-,-)
insert into table2(-,-) values(-,-)
insert into table3(-,-) values(-,-)
------lke this stored procedures contains different insertion statements.
by executing SP i want to run only one insert statement out of many.And i want to pass values as input parameters.So based on the input parameters ,particular input statement should execute.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, it is possible, but I doubt one could give you a sample without knowing the loginc, conditions and so on.
Here is a good starting point -> http://download.oracle.com
HTH
Ivo Stoykov