Link to home
Start Free TrialLog in
Avatar of gpinfotech
gpinfotechFlag for India

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

ASKER CERTIFIED SOLUTION
Avatar of jakemdrew
jakemdrew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
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/docs/html/A95261_01/jdgtut1.htm
HTH
Ivo Stoykov
Avatar of gpinfotech

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,val2)

insert into table2(-,-) values(valx,valy)
 
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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial