Jump to content

Recommended Posts

Posted

Hello,

I am testing the principle of calling a stored procedure in Unilogic 1.33.236 but I have a visible error message in the structure associated with the request:

  • Status: -5 (Not documented in the Unilogic help)
  • Status report : 2031 no data supplied for parameters in prepared statement


I am working with a MySQL database. The connector is correctly configured.
In PhpMyAdmin, I created a stored procedure to insert data in a table with the name of the dynamic table as described in this link: https://support.unitronics.com/index.php?/selfhelp/view-article/sql-dynamic-table-name
but adapting it to MySQL.
Here is the code for the stored procedure:

DELIMITER $$
CREATE PROCEDURE `insert_data`(IN `idStation` INT, IN `ts` INT)
BEGIN
SET @varTable = CONCAT('bd_acquisition_',idStation);
SET @query = CONCAT('INSERT INTO ',@varTable,'(`id_station`, `date_time`) VALUES(',idStation,',FROM_UNIXTIME(',ts,'))');
PREPARE dynQuery FROM @query;
EXECUTE dynQuery;
DEALLOCATE PREPARE dynQuery;
END$$
DELIMITER ;


I tested the call in phpmyadmin

CALL insert_data(10,123456);

and it works fine.
I've tested the call in the LADDER code by giving input values in hardcodes directly in the SQL statement and it works very well (without checking "Is Executing Stored Procedure") But I'd like to provide the input values through the SQL Query block and that's where it gets stuck...The problem comes from the call with the placeholders. Nothing works: ? , :param , @param , With or without "Is Executing Stored Procedure".

Does anyone have any ideas?

Thanks in advance
 

Posted

Hello,

I'll answer myself.

In the call code for the procedure stored in Unilogic, there was a comment before the call that the server didn't like. By removing the comment, everything worked correctly.

  • Upvote 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.