stored-procedures

mysql stored procedure error Commands out of sync; you can't run this command now

僤鯓⒐⒋嵵緔 提交于 2020-05-09 11:52:04
问题 I have a stored procedure which I call from PHP which works fine on my dev version which is running Maria DB. I transferred to production which is running mysql (5.5.53) a 'Commands out of sync; you can't run this command now' error. I have tried suggestions to make sure the connection is closed after each query. I have also tried $stmt->store_result(); & $stmt->free_result();. If I try $stmt-next_result(); I do not get this out of sync error, but my script exists the loop and I do not get

mysql stored procedure error Commands out of sync; you can't run this command now

ⅰ亾dé卋堺 提交于 2020-05-09 11:47:27
问题 I have a stored procedure which I call from PHP which works fine on my dev version which is running Maria DB. I transferred to production which is running mysql (5.5.53) a 'Commands out of sync; you can't run this command now' error. I have tried suggestions to make sure the connection is closed after each query. I have also tried $stmt->store_result(); & $stmt->free_result();. If I try $stmt-next_result(); I do not get this out of sync error, but my script exists the loop and I do not get

mysql stored procedure error Commands out of sync; you can't run this command now

寵の児 提交于 2020-05-09 11:47:22
问题 I have a stored procedure which I call from PHP which works fine on my dev version which is running Maria DB. I transferred to production which is running mysql (5.5.53) a 'Commands out of sync; you can't run this command now' error. I have tried suggestions to make sure the connection is closed after each query. I have also tried $stmt->store_result(); & $stmt->free_result();. If I try $stmt-next_result(); I do not get this out of sync error, but my script exists the loop and I do not get

How to convert datetime to timestamp in MS SQL stored function

半腔热情 提交于 2020-05-08 09:24:52
问题 There is a stored function which is called from table update trigger. Smt like this: FUNCTION [dbo].[DateTime2ToBigInt](@dt DATETIME2(7)) RETURNS BIGINT Need to convert input datetime to unix timestamp. Tried CONVERT( timestamp, @dt) and CAST(@dt AS TIMESTAMP) but both result in "Explicit conversion from data type datetime2 to timestamp is not allowed." Of course it's possible to do by mathematics, but I can't believe, that mssql doesn't have direct convert function 回答1: CREATE FUNCTION UNIX

LOOP into cursor until each IF ELSE true in oracle

江枫思渺然 提交于 2020-04-30 09:21:13
问题 I have written a cursor where I want to LOOP each and every column until it becomes true. So if all the IF statement matches to true then I want to insert the data into VALID table or at last I want to insert the incorrect data into the INVALID TABLE. Below is the cursor. Kindly let me know whether my step is accurate or Do I need to make any changes in that. create or replace procedure fiber_transm_valid_data as begin for cur_r in (select rj_span_id, rj_maintenance_zone_name, rj_maintenance

LOOP into cursor until each IF ELSE true in oracle

跟風遠走 提交于 2020-04-30 09:20:36
问题 I have written a cursor where I want to LOOP each and every column until it becomes true. So if all the IF statement matches to true then I want to insert the data into VALID table or at last I want to insert the incorrect data into the INVALID TABLE. Below is the cursor. Kindly let me know whether my step is accurate or Do I need to make any changes in that. create or replace procedure fiber_transm_valid_data as begin for cur_r in (select rj_span_id, rj_maintenance_zone_name, rj_maintenance

wrong number or types of arguments while calling Stored Proc

家住魔仙堡 提交于 2020-04-30 06:49:08
问题 I am calling Stored Proc from Spring Data JPA : Procedure is: create or replace procedure GET_LATEST_GC (arg1 IN VARCHAR2, res1 OUT VARCHAR2, res2 OUT VARCHAR2) AS BEGIN DELETE FROM GC_T WHERE id = arg1; COMMIT; BEGIN SELECT gc.NAME, s.SIP INTO res1, res2 FROM GC_T gc, STAFF_T s WHERE s.id = gc.id AND START_TIME = (SELECT MAX(START_TIME) FROM GC_T); EXCEPTION WHEN others THEN res1 := ''; END; END; Spring Data JPA code //Repository public interface ActiveDao extends JpaRepository<GcT,Integer>

Passing Output parameters to stored procedure using dapper in c# code

浪子不回头ぞ 提交于 2020-04-29 06:45:00
问题 I have a stored procedure in this format CREATE PROCEDURE SP_MYTESTpROC @VAR1 VARCHAR(10), @VAR2 VARCHAR(20), @BASEID INT , @NEWID INT OUTPUT As Begin INSERT INTO TABLE_NAME(username, firstname) select @VAR1, @VAR2 WHERE ID = @BASEID SET @NEWID = SCOPE_IDENTITY() AS INT END I am calling this stored procedure from C# code using dapper. My question is: how do I pass in the output parameter to the stored procedure while using dapper? 回答1: Just searching the Test.cs file you could find this

Passing Output parameters to stored procedure using dapper in c# code

℡╲_俬逩灬. 提交于 2020-04-29 06:44:29
问题 I have a stored procedure in this format CREATE PROCEDURE SP_MYTESTpROC @VAR1 VARCHAR(10), @VAR2 VARCHAR(20), @BASEID INT , @NEWID INT OUTPUT As Begin INSERT INTO TABLE_NAME(username, firstname) select @VAR1, @VAR2 WHERE ID = @BASEID SET @NEWID = SCOPE_IDENTITY() AS INT END I am calling this stored procedure from C# code using dapper. My question is: how do I pass in the output parameter to the stored procedure while using dapper? 回答1: Just searching the Test.cs file you could find this

Stored procedure - One Line select statement Syntax ERROR

北慕城南 提交于 2020-04-18 00:49:16
问题 One line select statement throws syntax error in SP, but the query if executed doesn't produce any error. The error changes to syntax error near - if I remove IN _HOSTID input parameter and DECLARE statements. Its very weird and I can't find the cause of the error. DELIMITER // CREATE PROCEDURE getTotalCCU(IN _HOSTID INTEGER) BEGIN DECLARE HOSTID INT; DECLARE TOTAL_ITEM INT; SELECT item_count FROM items WHERE hostid = '12345' and key_ LIKE '%_net%' AND NOT key_ LIKE '%Total_%' AND NOT key_