cancel
Showing results for 
Search instead for 
Did you mean: 

Can i pass Database Table as a parameter for a stored Procedure ??

Former Member
0 Kudos

Hi all

I have multiple CSV Files which i am importing into a Database Table through CTL load and after that i have to pass the Table to a procedure with different set of Records again and again. Please advice if there is any way to pass  a database Table as a Parameter to a Stored Procedure.

Thanks in Advance.

Regards

Vignesh J

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Yes it's possible to do that.

But please do your share of looking up the documentation.

Hint: "Developing Procedures" ,"Table types"

- Lars

Former Member
0 Kudos

Hi Lars

I went through the document but the problem is i have around 20 csv files to be loaded every day and each of them passed to 3 procedure as a parameter.

And These 20 csv Files have 3 Distinct Structure.

So if i create a table type i have to select the data from the Database Table and then store it in Temporary Table Type Variable and Then  Pass it as Parameter Right.

I want to Pass the 20 Database Table Directly to the Procedure and Not Store in Table Types and Then pass it as Parameter.

Regards

Vignesh J

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Dzianis

I guess you miss understood my Question

I need to use Different Files For the Same Logic Again and Again with Different set of Records.

For Ex :

               This is a Db Table : ABC

                and of Table Type : TYPE

-- To Read the Data Stored in the From the File.---------------

CREATE PROCEDURE READ_DATA( OUT O1 TYPE)

  LANGUAGE SQLSCRIPT

      AS

  BEGIN

   O1 = SELECT * FROM ABC WHERE CUST_ID = 'ABC' ;

  END;

--------------------------------------------------------------------------------------

--- Procedure that uses the Data-----------------------------------------

CREATE PROCEDURE LOGIC( IN ABC TYPE)

  LANGUAGE SQLSCRIPT

AS

  BEGIN

   inp = SELECT * FROM :ABC WHERE CUST_ID = 'ABC' ;

insert into bmw (select * from :inp);

  END;

------------------------------------------------------------------------------------------

Then in the Main Procedure :

CALL  READ_DATA (ABC); ---This Call Will Fetch the Data from the Table into the Table Type Variable

ADM = SELECT * FROM :ABC;

Call     LOGIC (ADM); --Then Pass the Variable to the Logic Procedure.

----

This is How Lars was Suggesting i just wanted to Known if there is any other way to implement the Logic.

Kindly Read the Use Case Properly Before Responding.

Regards

Vignesh J

lbreddemann
Active Contributor
0 Kudos

You need an ETL tool here, e.g. SAP DataServices.

See, passing table-typed variables into a procedure is a very basic functionality.

What you now revealed as a requirement is a full blown data loading process.

There are tools for that and you better use them instead of spending time finding out how difficult and time consuming it is to build something reasonable yourself.

That's what I think.

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

BTW: if you want to notify Former Member you better use the @<user name> method than adding a tag to your question...

Former Member
0 Kudos

Thanks Lars I have lots of unanswered Questions For which I am not able to Find a Suitable Answer.

Can You Please Help Me out in the Following

Regards

Vignesh J