If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Select into error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-05, 02:34
fadychammas fadychammas is offline
Registered User
 
Join Date: Oct 2003
Posts: 20
Select into error

Hi,

from powerbuilder script I'm using the following sql statement:

select max(user_id) into :ls_user from users;

(where ls_user is a string variable)

and I'm getting the following error

SQLSTATE = 37000
[MySQL][ODBC 3.51 Driver][mysqld-4.1.9-nt]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 '( user_id ) from users' at line 1

I'll get this error if I use also count.
In the ODBC I checked the options:
- Change BIGINT to INT
- Enable Dynamic cursor

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-31-05, 05:09
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
Stick the same query you are using in your PowerScript into a DataWindow, then trap the SQL Prepare event to see what raw SQL Syntax is being submitted to MySQL. My guess would be that something is going awry with the conversion of the syntax in the script to what is actually submitted to MySQL (possibly in the bind variable handling)...

Without understanding what the PowerBuilder Runtime is doing "behind the curtains" to cause a SQL error, you are fighting blind!

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On