Hi Elvis,
- So far PB has never officially supported MySQL.
- You can work it around by adopting the three resolutions below:
One:
Before you execute the SELECT statement, please add this code to run first.
string sql
sql = "SET sql_mode = 'IGNORE_SPACE' "
EXECUTE IMMEDIATE :sql ;
SELECT count (*) FROM employee where pid= ll_person ;
Two:
Change the ODBC settings for the MySQL Server Database, check the checkbox of the Ignore space after functions names item and save it and try it again.
Three:
You can work it around using the Dynamic SQL instead of the SELECT SQL statement as blew:
integer i
DECLARE my_cursor DYNAMIC CURSOR FOR SQLSA ;
PREPARE SQLSA FROM "SELECT count (*) FROM employee where pid="+string(ll_person) ;
OPEN DYNAMIC my_cursor ;
FETCH my_cursor INTO :i;
CLOSE my_cursor ;
- If you don't use the internal function "count", then the issue won’t happen.
You can try running this code below and see if it works.
select pid
into :i
from person
where pid = :ll_person ;
The reason is the internal function standard is different between MS SQL Server and MYSQL Server.
For example, there is a space between "count" and "(" in the command below. With this space, you can run this command below in MS SQL Server or ASA Server or Oracle Server, but you can't use this command in MYSQL server.
When you compile this code in PB, the count function will auto add the space between "count" and "(" and causes the error.
e.g.:
SELECT count ( * ) FROM employee where pid=1;
Regards,