Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

MySql syntax concat and insert into with stored procedure not working

$
0
0

hi all,

i have a code in stored procedure which adds 2tco string to the table in MySql database

i send this parameters on stored procedure

'4SR','09','foo'

and the error is

Procedure execution failed 1054 - Unknown column 'foo' in 'field list'

how to do resolve this?

here's the code

BEGINdeclare2tuni char(100);declare2tmonth int(2);declare2tyear int(4);declare2tco LONGTEXT;SET2tuni = tuni;SET2tmonth = tmonth;SET2tyear = YEAR(CURDATE());SET2tco = tco;SET@s = CONCAT('INSERT INTO t_contents_',2tuni,'_',2tmonth,'_',2tyear,' (contents) VALUES (',2tco,');');
PREPARE stmt FROM@s;EXECUTE stmt;END

Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>