Professional Web Applications Themes

Stored Procedure und insert on a variable tables - MySQL

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 ...

  1. #1

    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

    ivaylo.mateev.uos@googlemail.com Guest

  2. #2

    Default Re: Stored Procedure und insert on a variable tables

    I have found the solution :)

    ivaylo.mateev.uos@googlemail.com Guest

  3. #3

    Default Re: Stored Procedure und insert on a variable tables

    com <com>
    wrote:
     

    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
    PeterD Guest

Similar Threads

  1. Insert Recored and Stored Procedure
    By Speegs in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 6th, 06:24 PM
  2. ASP / Stored Procedure SQL Insert Help
    By Bill Kellaway in forum ASP
    Replies: 7
    Last Post: October 12th, 06:15 PM
  3. [SQL 6.5] Cannot access temporary tables from a stored procedure
    By beyond in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: August 6th, 06:37 PM
  4. Data From INSERT In Stored Procedure Does Not Appear In Table
    By Leonard in forum Microsoft SQL / MS SQL Server
    Replies: 15
    Last Post: August 5th, 11:03 PM
  5. New to Stored Procedure my Insert SP is doubling
    By John in forum Microsoft SQL / MS SQL Server
    Replies: 7
    Last Post: July 14th, 12:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139