Need some help for this error message that appears on delphi 7
First, i will describe some script:
On mySQL procedure script:
CREATE PROCEDURE ActualStok()
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SELECT B.KD_BRG, B.NAMA_BRG, B.UKURAN, B.SATUAN,
(B.JUMLAH_BRG-(SELECT IFNULL(SUM(D.JUMLAH_PAKAI_BRG),0)
FROM DETAIL_PAKAI_BRG D
WHERE (D.STATUS_AMBIL='0') AND (D.KD_BRG=B.KD_BRG) AND (D.UKURAN=B.UKURAN)
AND (D.SATUAN=B.SATUAN))),
B.KETERANGAN_BRG
FROM BARANG B;
END;
Then i check that procedure --> CALL ActualStok();
And it's work. mySQL show me the expected result, and fine. There is no error.
So on delphi program, i try to execute this script:
procedure TFrmPersediaan.Button1Click(Sender: TObject);
begin
FrmDtm.ADOQBarang.Close;
FrmDtm.ADOQBarang.SQL.Clear;
FrmDtm.ADOQBarang.SQL.Add('CALL ActualStok()');
FrmDtm.ADOQBarang.Open;
end;
Delphi shows me a error message "Multiple-step operation generated errors. Check each status value."
Please somebody to help me to solve this problem.
Thank you for any participant.
This might due to unsupported date values by ADO. In my case the error was caused by date value 01-01-0020 in my Oracle database, which isn't recognized by ADO.
Related
I'm trying to implement a MySQL procedure (with if/else statements) inside a Granada query. The only issue is it won't let me create my procedure and call it from the same query...
ERROR
db query error: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CALL tester(true)' at line 44
I'm confident the issue isn't with my syntax, but here's how the query looks:
CREATE PROCEDURE tester(
IN is_empty BOOLEAN
)
BEGIN
IF(is_empty) THEN
SELECT
...
from $dbName.table1
where KernelName IN ($KernelNameFilter) AND `gpu-id` in ($gpuFilter) AND `Index` in ($DispatchIDFilter)
union SELECT
...
from $dbName.table1
where KernelName IN ($KernelNameFilter) AND `gpu-id` in ($gpuFilter) AND `Index` in ($DispatchIDFilter)
ELSE
SELECT
...
from $dbName.table1
where KernelName IN ($KernelNameFilter) AND `gpu-id` in ($gpuFilter) AND `Index` in ($DispatchIDFilter);
END IF;
END;
CALL tester(true);
They seem to work on their own, but I have no idea why Grafana doesn't like this syntax. Any ideas?
NOTE:
Yes, it is necessary for me to create the procedure in Grafana query b/c I need to reference local Grafana variables (i.e. $KernelNameFilter, $gpuFilter, ...)
It's likely that you can't create procedure and call the procedure in a single call to the query interface. Most query interfaces do not support multi-query.
Even if the query interface supports multi-query, you can't use it to define a stored routine. Multi-query interfaces assume semicolon terminates the statement, so the first semicolon inside the body of your procedure would terminate the whole CREATE PROCEDURE statement. That's not what you want.
The MySQL client solves this by requiring you to change the statement terminator to something that doesn't appear in the body of the CREATE PROCEDURE statement. See https://dev.mysql.com/doc/refman/8.0/en/stored-programs-defining.html for details.
I need to reference local Grafana variables (i.e. $KernelNameFilter, $gpuFilter, ...)
You should make a procedure that takes your Grafana variables as parameters, and uses them in the queries within the procedure body — not create a brand new procedure each time you need to run the procedure.
CREATE or replace procedure `isEven`(IN num int,OUT result varchar(6)) is
BEGIN
set result=(select IF(MOD(num,2)=0,"Even","Odd"));
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ("Error!");
END isEven;
I am trying to make a stored procedure but there is an error in my code I can't understand what is the issue in this code.
Can anyone let me the correct syntax of the exception?
CREATE TRIGGER agecheck AFTER INSERT ON student
FOR EACH
ROW
BEGIN
IF (CURRENT_DATE-Dateofbirth) > 16
THEN dbms_output.put_line('Age must be greater than 16');
END IF;
END;
I am trying to write this trigger in phpmyadmin but it gives an error on dbms_output.put_line. It says "you have an error in your sql syntax". Can anyone please help me out with this?
dbms_output.put_line is an Oracle pl/sql call, it is not available in mysql. There is no direct equivalent in mysql's procedural language. The closest thing to this call is perhaps SIGNAL command with class 01 (warning) or you can create a table into which the trigger can insert its messages.
Hi all,
Am new to mysql.Actually am oracle developer now am converting some procedure from oracle to mysql.In those changes I have doubt in Mysql.
In Oracle:-
Create procudure test_proc(p_id in varchar2,
p_error_code out number,
p_error_msg out varchar2) is
begin
insert into test_1(a) values(p_id);
commit;
p_error_code:=0;
exception when others then
p_error_code:=1;
p_error_msg:=substr(sqlerrm,1,150);
rollback;
return;
end;
I need same type of procedure in mysql or sample procedure how to handle exception and show it error as output variable like sqlerrm in oracle.
Thanks and regards,
vinoth
You can use EXIT and CONTINUE Handler. But you cant get clear error details as you get in ORACLE.
So I have this stored proc that will not get created when I run the file.
DELIMITER //
DROP PROCEDURE IF EXISTS msd.test_proc//
CREATE PROCEDURE msd.test_proc()
BEGIN
SELECT
'Hello proc'
FROM
msd.zipcode_lookup;
END//
DELIMITER ;
When I run this I get an error code 1064 at line 1 when I execute in RazorSQL. Here is the complete error message:
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near '//
CREATE PROCEDURE msd.test_proc()
BEGIN
SELECT
'Hello proc'
FROM ' at line 1
Error Code:1064
I've tried other variations and still get errors. I am sure this is something basic I am missing. I appreciate any help.
Thanks.
As stated on the RazorSQL website:
The DELIMITER statement is not part of the MySQL language. It is a command supported by certain MySQL tools. This command tells those MySQL programs to scan for a certain character that indicates the end of a query or statement.
RazorSQL does not support using the DELIMITER command. The SQL statement delimiter value used by RazorSQL can be changed using the preferences window. The default values is the semi-colon.