I was wondering if I could get some help. I have the following function in Postgresql which is designed to give me a "solrid" value without having to store it each time in the database, and basically works by putting an "A" at the start of the value.
-- Setup Solrid Function
CREATE OR REPLACE FUNCTION solrid(IN local_id INTEGER, OUT result TEXT) AS $$
DECLARE
database_id TEXT := 'A';
BEGIN
result := database_id || local_id::TEXT;
END;
$$ LANGUAGE PLPGSQL;
I now have to move my database to MySql and I was wondering if anyone could tell me how I can convert this function to work with MySQL.
CREATE OR REPLACE FUNCTION solrid(integer) RETURNS text AS $$ SELECT 'A'||$1; $$ LANGUAGE SQL. This would be a heck of a lot faster and could often be inlined away.