Stored Procedure und insert on a variable tables

This is a discussion on Stored Procedure und insert on a variable tables within the MySQL Database forums, part of the Database Forums category; create procedure createKonto($myKonto integer, $einzahlung double) BEGIN DECLARE $t TEXT; IF ( NOT EXISTS ( select * from konto where kontoNr = $myKonto ) ) ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-03-2007
ivaylo.mateev.uos@googlemail.com
 
Posts: n/a
Default Stored Procedure und insert on a variable tables

create procedure createKonto($myKonto integer,
$einzahlung double)
BEGIN
DECLARE $t TEXT;
IF (
NOT EXISTS (
select * from konto where kontoNr = $myKonto
)
)
THEN
SET $t = CONCAT('konto_' , CAST($myKonto AS CHAR));
INSERT INTO konto (kontoNr, kontoStand)
VALUES( $myKonto,$einzahlung );
INSERT INTO $t (buhung, erfolg) VALUES($einzahlung,
1);
END IF;
END "
-- DELIMITER ;

I just want to insert $myKonto und $einzahlubg in the table
konto_myKonto, where myKonto is an account number
but i get Table $t does not exists. How can i make mysql to insert not
in $t but in the table which is saved as TEXT in $t

Reply With Quote
  #2 (permalink)  
Old 06-03-2007
ivaylo.mateev.uos@googlemail.com
 
Posts: n/a
Default Re: Stored Procedure und insert on a variable tables

I have found the solution :)

Reply With Quote
  #3 (permalink)  
Old 06-04-2007
PeterD
 
Posts: n/a
Default Re: Stored Procedure und insert on a variable tables

ivaylo.mateev.uos@googlemail.com <ivaylo.mateev.uos@googlemail.com>
wrote:

> I have found the solution :)


So what was your solution?

If you had this problem, then someone else might also have the problem
and if they search newsgroups for the same problem, all they'll find is
your original problem, and that you found a solution, but no solution
given.

--
Pd
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:21 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0