SUCCESS:Re: Can I use a parameter for a colum name ?
success (see sproc below)
So as Santa said "Yes Virginia, you CAN use a parameter for a colum name"
My errors were:
1. the CONCAT syntax, it needs the substrings separated by comma !
2. customerID is an int not a string
happy holidays to all
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `test_procedure`(IN ColumnNameParam varchar(10) )
BEGIN
set @ColumnName = ColumnNameParam;
set @s = CONCAT("UPDATE customer set ", @ColumnName, " = 'Test of ColumnNameParam' WHERE customer_id = ", 1);
PREPARE stmt FROM @s;
EXECUTE stmt;
END
Subject
Views
Written By
Posted
2120
December 07, 2012 12:19PM
1065
December 07, 2012 06:42PM
1119
December 08, 2012 12:42PM
SUCCESS:Re: Can I use a parameter for a colum name ?
1103
December 08, 2012 02:07PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.