Skip to content

Tag: function

Cant understand my syntax mistake in MySQL CREATE FUNCTION

This is my code and I can not find the mistake! I am trying to create a function that multiplies a value to de input parameter and returns that result! It should not be that difficult but I am not finding my sintaxt mistake The mistake says: error code 1064 Answer The DECLARE has to be before the code. I

How to make mysql function that return from the select result?

I want to create this function on mySql 8. It will create a sequence number like 00001,00002 i dunno whats wrong with this query but i always got this error. I also tried with this query. but still gave me with the same error. What could go wrong with my function query ? Answer Multiple datatype convertions a…

SQL Function has no destination when called

I’m getting a success when creating the below function, but when I call it I receive an error stating there is no destination. Answer Language SQL: https://www.postgresql.org/docs/current/xfunc-sql.html language plpgsql: https://www.postgresql.org/docs/current/plpgsql.html Language sql is more easier to…

While loop function union function end

I want to loop the code shown below. I would like to use the [getpublicholidays] function for a variable number of years and merge them (union). Unfortunately I don’t know how to use the function in a loop with union. Can someone help? Answer If you are looping for X years, each time you loop to a new y…

User function return query and insert into

I trying to make function, that merge where select query return result as value(not table) and insert into that use value from select statement. The function where argument gets from user, and this argument provide into select query on table_foo that return value id where I try set and use in insert into to d…