• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Initialize Table variable with the result set from select statement

 
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you require a variable of type table?
 
Fred Victa
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic