Yes, this is homework . . .
I have got two tables. (I have a few more, but we don't need to discuss them all now.) They are rather like this:-
And "name" is UNIQUE and "number" is declared as a primary key.
Here, "id" is a primary key and "number" is a secondary key; it references "number" in table "a". [I mean foreign key, not secondary key.]
Now, I have a couple of stored procedures. Both work nicely, something like this_;
I don't need to change "insert_into_a,", but I would like to pass "name" to "insert_into_b", so I would get something like this:-
I have tried things like
define number int; @number_in := SELECT number FROM a WHERE name = name_in;number_in = a.number WHERE a.name = name_in; etcand none of them works.
What is the easiest way to get a local number variable to insert?
CR
[edit]A minor spelling correction[/edit]
[ May 07, 2007: Message edited by: Campbell Ritchie ]