Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9257611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:11:22+00:00 2026-06-18T12:11:22+00:00

I am running through a dataset with a cursor. In each cursor pass a

  • 0

I am running through a dataset with a cursor.
In each cursor pass a string gets split up using a stored procedure which writes the single elements in a temporary table SplitValues, one value per row. Each dataset also has a unique ID ds_id

SplitValues

value   |
--------+
Item1   | 
Item2   | 
Item3   | `

I also have a reference table which has IDs for each of the items the split function could possibly produce:

classes

id | class |
---+--------
5  | Item1 |
6  | Item2 |
7  | Item3 |
8  | Item4 |
9  | Item5 |

What I now want to do is to go through all rows of SplitValues and write them to a table to store the data, however using the ID of the class and not the class itself to save storage:

storage

ds_id | class_id |
------+-----------
0     | 5        |
0     | 6        |
0     | 7        |

This should be fairly simple but I am failing. I did multiple attempts, one was the following cursor loop:

FETCH cur1 INTO ds_id, string;
CALL `Split_String`(string, ',');

INSERT INTO storage (ds_id, class_id) 
    SELECT ds_id, 
        (SELECT classes.id FROM classes WHERE class = SplitValues.value ) as class_id ;

[...]

Error produced Unknown column 'SplitValues.value' in 'where clause'

I have searched a lot and think my problem is somehow related to aliases but was unable to find a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:11:22+00:00Added an answer on June 18, 2026 at 12:11 pm

    Try this

    [...]
    INSERT INTO storage (ds_id, class_id) 
    SELECT ds_id, c.id
      FROM classes c INNER JOIN 
           SplitValues s ON c.class = s.value
    [...]
    

    Here is sqlfiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running through this tutorial found here: http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_multiple_tables.htm which teaches how to pass a
Using SQL Server 2008 I created a Stored Procedure called MyStoreProc and it runs
I have imported a stored procedure that returns a dataset into my Entity Framework.
I'm running through the Koans tutorial (which is a great way to learn) and
when running through a result set, how efficient is this approach as compared to
I'm running through a pretty simple Flash based website tutorial from ActiveTuts. Any who,
I'm running through the gitimmersion.com labs and every time I run a: git hist
I am running through the Rails Tutorial by Michael Hartl (Screen Cast). Ran into
I'm running through my web app and I'm trying to test various parts of
I'm running through some memory profiling for my application in SDK 3.2 and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.