Home > Back-end >  Delphi a potential problem: open the cursor statement behind, and assignment is given no effect!
Delphi a potential problem: open the cursor statement behind, and assignment is given no effect!

Time:04-17

Delphi7 invoke MySql stored procedures, under the open the cursor in the process of storage, give and assign a value to the stored procedure, can not get out the parameter values, as shown below:
Create procedure MyProc (in inpara varchar (20), the out outpara varchar (100))
The begin
.
Declare cur1 cursor for the select id from table1;
The open cur1;
The set outpara='ABC';//as long as in the open cur1; Behind the statement, won't get outpara values, are shown as empty,
.
end;
To solve!

CodePudding user response:

Outpara='ABC';

CodePudding user response:

Outpara='ABC';
Don't have to add in front of the set??
So no, warrior

CodePudding user response:

Online urgent, estimates that this is a potential problem, the altar to also can't solve!!!

CodePudding user response:

When you check, whether because of the open to the exception, lead to the code and didn't perform, can add exception handling,

CodePudding user response:

Without exception, in Navicat Premium in debugging the parameter values can be extracted, the cursor is a very simple query, after opening, do nothing, just close the cursor, followed by a given assignment,

CodePudding user response:

reference 5 floor lcmlhs_2005 reply:
there is no exception, in Navicat Premium in debugging the parameter values can be extracted, the cursor is a very simple query, after opening, do nothing, just close the cursor, followed by a given assignment,


Navicat Premium in debugging the parameter values can be extracted, then it should not be stored procedure inside,

CodePudding user response:

Yes, I feel should be Delphi program invokes the stored procedures have a question, but can not find, because as long as you don't open the cursor in the process of storage, can extract to return values, Delphi program execution call stored procedure code is as follows:
.
SStr:='a';
With adostoreproc1. The parameters do
The begin
Createparameter (' INPARA 'ftstring, pdinput, 100, sStr);
Createparameter (' OUTPARA 'ftstring, pdoutput, 4000, null);
end;
Adostoreproc1. Execproc;
Sout:=adostoreproc1. The parameters. Parambyname (' OUTPARA). The value;//interrupt point here, return parameter value is empty, sout nature is empty,
.

CodePudding user response:

refer to 6th floor tanqth response:
Quote: refer to the 5 floor lcmlhs_2005 response:
there is no exception, in Navicat Premium in debugging the parameter values can be extracted, the cursor is a very simple query, after opening, do nothing, just close the cursor, followed by a given assignment,


Navicat Premium in debugging the parameter values can be extracted, then it should not be stored procedure internal problems,

Help have a look at my code, is there anything that's where I omissions,

CodePudding user response:

Createparameter (' OUTPARA 'ftstring, pdoutput, 100, ");

To try this
  • Related