Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Initialize Table variable with the result set from select statement

 
Fred Victa
Ranch Hand
Posts: 189
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following table variable defined in my stored procedure:
TYPE EmployeeIDTable IS TABLE OF VARCHAR2(20);
lv_employee_id_table EmployeeIDTable;

How would I initialize lv_employee_id_table with the result set returned from a select statement?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you require a variable of type table?
 
Fred Victa
Ranch Hand
Posts: 189
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Why would you require a variable of type table?


I thought it would hold the values from the result set.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred Victa wrote:
Roel De Nijs wrote:Why would you require a variable of type table?


I thought it would hold the values from the result set.

But what do you want to do with these values? Use it in your stored procedure? Return it to your java application?

And akways nice to know: which database are you using?
 
Fred Victa
Ranch Hand
Posts: 189
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Fred Victa wrote:
Roel De Nijs wrote:Why would you require a variable of type table?


I thought it would hold the values from the result set.

But what do you want to do with these values? Use it in your stored procedure? Return it to your java application?

And akways nice to know: which database are you using?


I would like to have two lists: a list of values from a stored procedure and a list of values from a xml file. I'll use these lists in my stored procedure to do some comparisons.

I'm using Oracle.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred Victa wrote:I would like to have two lists: a list of values from a stored procedure and a list of values from a xml file. I'll use these lists in my stored procedure to do some comparisons.

So you have a list of values in a stored procedure, and want to use this list in another stored procedure to do some comparisons with a list of values from a xml file?
 
Fred Victa
Ranch Hand
Posts: 189
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Fred Victa wrote:I would like to have two lists: a list of values from a stored procedure and a list of values from a xml file. I'll use these lists in my stored procedure to do some comparisons.

So you have a list of values in a stored procedure, and want to use this list in another stored procedure to do some comparisons with a list of values from a xml file?


Both lists are going to be used in the same stored procedure. The xml file is one of the IN parameters for the stored procedure.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No experience with an Oracle database (using SQL Server), but this seems to do what you are looking for. And this might be helpful as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic