Questions tagged [mysql-function]
75 questions
0
votes
0 answers
how to use replace to replace string names found in query
I have the following table :
and on the other side I have a string that can contain words from the above table , ex:
"Jeff El ABC THE DEF"
I need to do the following :
REPLACE("Jeff El ABC THE DEF", Select words from table,"");
So I need to remove…

hussein wehbe
- 1
- 1
0
votes
0 answers
Hexadecimal conversation to Float - Big Endian
I have a bit of a challenge in converting a hexadecimal string into a float.
Here is an example:
Hex:
3F62 0C3C
Binary: "00111111011000100000110000111100"
Conversation result (float big endian):
0.8829992
Can this conversion be achieved with mysql…

rhh
- 47
- 7
0
votes
1 answer
How to create an insert function based on conditions
I am having a little trouble with my function. I am getting a syntax error and I do not know how to insert multiple things in one go.
Essentially I want the safe_insert() function to take in:
_museum_id the id from the museums table
_curr_date a…

Yuri
- 89
- 1
- 1
- 9
0
votes
0 answers
syntax error problem on END keyword with MySQL code
Why do I get a syntax error when everything looks fine. The error position on the MySQL workbench is indicated.
I have checked alot of questions, but found no answer. I know it will be a minor problem but I can't figure it out
SELECT * FROM…

Kennedy
- 27
- 8
0
votes
1 answer
using if else in mysql user defined function
This is my query that basically takes two numbers that adds them and multiplies the sum by 10
DELIMITER $$
CREATE FUNCTION tot(a int(4),b INT(4)) RETURNS INT(4)
BEGIN
RETURN ROUND((a+b)*10/9);
END $$
DELIMITER ;
everything is working fine , but I…

Luis
- 43
- 7
0
votes
1 answer
Specifying MAX group function in MySQL for versioned data
I have the following MySQL table:
[orders]
===
order_id BIGINT UNSIGNED AUTO INCREMENT (primary key)
order_ref_id VARCHAR(36) NOT NULL,
order_version BIGINT NOT NULL,
order_name VARCHAR(100) NOT NULL
...
lots of other fields
The orders are…

hotmeatballsoup
- 385
- 6
- 58
- 136
0
votes
0 answers
How to get the value from hash if the key is present using json mysql function json_extract
data:
{"a": {"b": [{"name": "s", "value": "2"}, {"name": "r", "value": "100113"}, {"name": "r", "value": "1121202"}]}}
here is want to get the value when name is "r",
output:
value:
"100113"
"1121202"
what to do using json mysql functions like…

honey k
- 1
0
votes
1 answer
Mysql View where a value is split over multiple rows according to date
MySql version: 5.6.47
Assuming I have a table like this:
[from:Datetime][to:Datetime][amount:Decimal(10,2)]
[2020/01/15 ][2020/02/15 ][300 ]
I want to create a view like this out of…

SomeStranger314
- 327
- 1
- 3
- 12
0
votes
1 answer
can anyone help me to solve the error in this SQL query?
I am trying to create a SQL function which will take 2 parameters and convert to requested case format.My query is
DELIMITER $$
CREATE FUNCTION Convertcase(
sentence VARCHAR(50),req_case VARCHAR(50)
)
RETURNS…

Minu
- 37
- 1
- 5
0
votes
3 answers
Unable to handle exception in MYSQL Function
I am not very familiar with MYSQL functions & exception handling. After all the research I could come up with below, but to no gain.
I am trying to return 0 if insert statement execution fails and 1 otherwise. Exception is getting raised instead of…

Snehasis Panda
- 65
- 1
- 10
0
votes
0 answers
MySQL - Capitalize first letter of each word including Turkish Characters
I have mysql function that capitalizes the first letter of each word in desired string.
What I want to do is to convert Turkish characters to Turkish occurence instead of English occurence such as;
i = I (should be İ), ş = S (should be Ş)…

Pelin
- 467
- 4
- 17
0
votes
2 answers
"No Return Found" error in simple mysql function
I'm using xampp with phpMyAdmin to manage a MySql database.
When creating a function I got a "No Return Found" error, so I stripped down the function to narrow the origin of the error I got to the simplest case where it still doesn't work.
And the…

Lince Assassino
- 111
- 3
0
votes
3 answers
Creating a mysql function to manipulate a date
I want to create a function in mysql 5.7 which receives two dates and checks if there is a difference. If yes it should add one day to the second date and return it. If not, it should return the date without any manipulation.
Unfortunately I receive…

Brotzka
- 2,959
- 4
- 35
- 56
0
votes
1 answer
Mysql Stored Function Nested Query (SELECT inside INSERT Query)
Tables
create table category(id int primary key auto_increment, name varchar(30));
insert into category(name) values('Snacks'),('Soft Drink'),('Raw');
create table material(id int primary key auto_increment, name text, catID int references…

अक्षय परूळेकर
- 314
- 4
- 16
0
votes
1 answer
how to pass parameter to function of mysql through vb.net adapter which is created by query builder wizard
I have this query:
SELECT * FROM table_1 WHERE (`update_column` = (DATE_SUB(curdate(), INTERVAL 10 DAY)))
It works normally, I want to change 10 day to parameter and pass value of it through adapter, I'm using query builder, with query in…

abbas
- 33
- 4